Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
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" |
Harvey Harrison | 3c9a320 | 2008-02-29 11:59:26 +0100 | [diff] [blame] | 33 | #include "hda_patch.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 75 | ALC260_HP_3013, |
| 76 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 77 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 78 | ALC260_WILL, |
| 79 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 80 | #ifdef CONFIG_SND_DEBUG |
| 81 | ALC260_TEST, |
| 82 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 83 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 84 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | }; |
| 86 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 87 | /* ALC262 models */ |
| 88 | enum { |
| 89 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 90 | ALC262_HIPPO, |
| 91 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 92 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 93 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 94 | ALC262_HP_BPC_D7000_WL, |
| 95 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 96 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 97 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 98 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 99 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 100 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 101 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 102 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 103 | ALC262_NEC, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 104 | ALC262_AUTO, |
| 105 | ALC262_MODEL_LAST /* last tag */ |
| 106 | }; |
| 107 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 108 | /* ALC268 models */ |
| 109 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 110 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 111 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 112 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 113 | ALC268_ACER, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 114 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 115 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 116 | #ifdef CONFIG_SND_DEBUG |
| 117 | ALC268_TEST, |
| 118 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 119 | ALC268_AUTO, |
| 120 | ALC268_MODEL_LAST /* last tag */ |
| 121 | }; |
| 122 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 123 | /* ALC269 models */ |
| 124 | enum { |
| 125 | ALC269_BASIC, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 126 | ALC269_ASUS_EEEPC_P703, |
| 127 | ALC269_ASUS_EEEPC_P901, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 128 | ALC269_AUTO, |
| 129 | ALC269_MODEL_LAST /* last tag */ |
| 130 | }; |
| 131 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 132 | /* ALC861 models */ |
| 133 | enum { |
| 134 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 135 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 136 | ALC861_3ST_DIG, |
| 137 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 138 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 139 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 140 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 141 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 142 | ALC861_AUTO, |
| 143 | ALC861_MODEL_LAST, |
| 144 | }; |
| 145 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 146 | /* ALC861-VD models */ |
| 147 | enum { |
| 148 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 149 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 150 | ALC861VD_3ST, |
| 151 | ALC861VD_3ST_DIG, |
| 152 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 153 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 154 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 155 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 156 | ALC861VD_AUTO, |
| 157 | ALC861VD_MODEL_LAST, |
| 158 | }; |
| 159 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 160 | /* ALC662 models */ |
| 161 | enum { |
| 162 | ALC662_3ST_2ch_DIG, |
| 163 | ALC662_3ST_6ch_DIG, |
| 164 | ALC662_3ST_6ch, |
| 165 | ALC662_5ST_DIG, |
| 166 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 167 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 168 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 169 | ALC663_ASUS_M51VA, |
| 170 | ALC663_ASUS_G71V, |
| 171 | ALC663_ASUS_H13, |
| 172 | ALC663_ASUS_G50V, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 173 | ALC662_AUTO, |
| 174 | ALC662_MODEL_LAST, |
| 175 | }; |
| 176 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 177 | /* ALC882 models */ |
| 178 | enum { |
| 179 | ALC882_3ST_DIG, |
| 180 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 181 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 182 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 183 | ALC882_TARGA, |
| 184 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 185 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 186 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 187 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 188 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 189 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 190 | ALC882_MODEL_LAST, |
| 191 | }; |
| 192 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 193 | /* ALC883 models */ |
| 194 | enum { |
| 195 | ALC883_3ST_2ch_DIG, |
| 196 | ALC883_3ST_6ch_DIG, |
| 197 | ALC883_3ST_6ch, |
| 198 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 199 | ALC883_TARGA_DIG, |
| 200 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 201 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 202 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 203 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 204 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 205 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 206 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 207 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 208 | ALC888_LENOVO_MS7195_DIG, |
| 209 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 210 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 211 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 212 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 213 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 214 | ALC883_FUJITSU_PI2515, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 215 | ALC883_3ST_6ch_INTEL, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 216 | ALC883_AUTO, |
| 217 | ALC883_MODEL_LAST, |
| 218 | }; |
| 219 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 220 | /* for GPIO Poll */ |
| 221 | #define GPIO_MASK 0x03 |
| 222 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | struct alc_spec { |
| 224 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 225 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | unsigned int num_mixers; |
| 227 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 228 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 229 | * don't forget NULL |
| 230 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 231 | */ |
| 232 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 234 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | struct hda_pcm_stream *stream_analog_playback; |
| 236 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 237 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 238 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 240 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | struct hda_pcm_stream *stream_digital_playback; |
| 242 | struct hda_pcm_stream *stream_digital_capture; |
| 243 | |
| 244 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 245 | struct hda_multi_out multiout; /* playback set-up |
| 246 | * max_channels, dacs must be set |
| 247 | * dig_out_nid and hp_nid are optional |
| 248 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 249 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | |
| 251 | /* capture */ |
| 252 | unsigned int num_adc_nids; |
| 253 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 254 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 255 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | |
| 257 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 258 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | const struct hda_input_mux *input_mux; |
| 260 | unsigned int cur_mux[3]; |
| 261 | |
| 262 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 263 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 265 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | |
| 267 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 268 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 269 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 270 | /* dynamic controls, init_verbs and input_mux */ |
| 271 | struct auto_pin_cfg autocfg; |
| 272 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 273 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 274 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 275 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 276 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 277 | /* hooks */ |
| 278 | void (*init_hook)(struct hda_codec *codec); |
| 279 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 280 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 281 | /* for pin sensing */ |
| 282 | unsigned int sense_updated: 1; |
| 283 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 284 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 285 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 286 | /* for virtual master */ |
| 287 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 288 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 289 | struct hda_loopback_check loopback; |
| 290 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 291 | |
| 292 | /* for PLL fix */ |
| 293 | hda_nid_t pll_nid; |
| 294 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 295 | }; |
| 296 | |
| 297 | /* |
| 298 | * configuration template - to be copied to the spec instance |
| 299 | */ |
| 300 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 301 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 302 | * with spec |
| 303 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 304 | const struct hda_verb *init_verbs[5]; |
| 305 | unsigned int num_dacs; |
| 306 | hda_nid_t *dac_nids; |
| 307 | hda_nid_t dig_out_nid; /* optional */ |
| 308 | hda_nid_t hp_nid; /* optional */ |
| 309 | unsigned int num_adc_nids; |
| 310 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 311 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 312 | hda_nid_t dig_in_nid; |
| 313 | unsigned int num_channel_mode; |
| 314 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 315 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 316 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 317 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 318 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 319 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 320 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 321 | struct hda_amp_list *loopbacks; |
| 322 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | }; |
| 324 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | |
| 326 | /* |
| 327 | * input MUX handling |
| 328 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 329 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 330 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | { |
| 332 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 333 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 334 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 335 | if (mux_idx >= spec->num_mux_defs) |
| 336 | mux_idx = 0; |
| 337 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | } |
| 339 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 340 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 341 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | { |
| 343 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 344 | struct alc_spec *spec = codec->spec; |
| 345 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 346 | |
| 347 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 348 | return 0; |
| 349 | } |
| 350 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 351 | static int alc_mux_enum_put(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; |
| 356 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 357 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 358 | hda_nid_t nid = spec->capsrc_nids ? |
| 359 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 360 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 361 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | } |
| 363 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 364 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | /* |
| 366 | * channel mode setting |
| 367 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 368 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 369 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 370 | { |
| 371 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 372 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 373 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 374 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | } |
| 376 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 377 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 378 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | { |
| 380 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 381 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 382 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 383 | spec->num_channel_mode, |
| 384 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | } |
| 386 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 387 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 388 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | { |
| 390 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 391 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 392 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 393 | spec->num_channel_mode, |
| 394 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 395 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 396 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 397 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | } |
| 399 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 401 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 402 | * instead of "%" to avoid consequences of accidently treating the % as |
| 403 | * being part of a format specifier. Maximum allowed length of a value is |
| 404 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 405 | * |
| 406 | * Note: some retasking pin complexes seem to ignore requests for input |
| 407 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 408 | * are requested. Therefore order this list so that this behaviour will not |
| 409 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 410 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 411 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 412 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 413 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 414 | "Mic 50pc bias", "Mic 80pc bias", |
| 415 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 416 | }; |
| 417 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 418 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 419 | }; |
| 420 | /* 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] | 421 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 422 | * addition, "input" pins may or may not process the mic bias option |
| 423 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 424 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 425 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 426 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 427 | #define ALC_PIN_DIR_IN 0x00 |
| 428 | #define ALC_PIN_DIR_OUT 0x01 |
| 429 | #define ALC_PIN_DIR_INOUT 0x02 |
| 430 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 431 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 432 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 433 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 434 | * For each direction the minimum and maximum values are given. |
| 435 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 436 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 437 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 438 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 439 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 440 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 441 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 442 | }; |
| 443 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 444 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 445 | #define alc_pin_mode_n_items(_dir) \ |
| 446 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 447 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 448 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 449 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 450 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 451 | unsigned int item_num = uinfo->value.enumerated.item; |
| 452 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 453 | |
| 454 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 455 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 456 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 457 | |
| 458 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 459 | item_num = alc_pin_mode_min(dir); |
| 460 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 461 | return 0; |
| 462 | } |
| 463 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 464 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 465 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 466 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 467 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 468 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 469 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 470 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 471 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 472 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 473 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 474 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 475 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 476 | /* Find enumerated value for current pinctl setting */ |
| 477 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 478 | 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] | 479 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 480 | *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] | 481 | return 0; |
| 482 | } |
| 483 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 484 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 485 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 486 | { |
| 487 | signed int change; |
| 488 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 489 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 490 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 491 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 492 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 493 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 494 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 495 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 496 | 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] | 497 | val = alc_pin_mode_min(dir); |
| 498 | |
| 499 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 500 | if (change) { |
| 501 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 502 | snd_hda_codec_write_cache(codec, nid, 0, |
| 503 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 504 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 505 | |
| 506 | /* Also enable the retasking pin's input/output as required |
| 507 | * for the requested pin mode. Enum values of 2 or less are |
| 508 | * input modes. |
| 509 | * |
| 510 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 511 | * reduces noise slightly (particularly on input) so we'll |
| 512 | * do it. However, having both input and output buffers |
| 513 | * enabled simultaneously doesn't seem to be problematic if |
| 514 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 515 | */ |
| 516 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 517 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 518 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 519 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 520 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 521 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 522 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 523 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 524 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 525 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 526 | } |
| 527 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 528 | return change; |
| 529 | } |
| 530 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 531 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 532 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 533 | .info = alc_pin_mode_info, \ |
| 534 | .get = alc_pin_mode_get, \ |
| 535 | .put = alc_pin_mode_put, \ |
| 536 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 537 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 538 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 539 | * together using a mask with more than one bit set. This control is |
| 540 | * currently used only by the ALC260 test model. At this stage they are not |
| 541 | * needed for any "production" models. |
| 542 | */ |
| 543 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 544 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 545 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 546 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 547 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 548 | { |
| 549 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 550 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 551 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 552 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 553 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 554 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 555 | |
| 556 | *valp = (val & mask) != 0; |
| 557 | return 0; |
| 558 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 559 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 560 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 561 | { |
| 562 | signed int change; |
| 563 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 564 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 565 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 566 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 567 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 568 | AC_VERB_GET_GPIO_DATA, |
| 569 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 570 | |
| 571 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 572 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 573 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 574 | gpio_data &= ~mask; |
| 575 | else |
| 576 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 577 | snd_hda_codec_write_cache(codec, nid, 0, |
| 578 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 579 | |
| 580 | return change; |
| 581 | } |
| 582 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 583 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 584 | .info = alc_gpio_data_info, \ |
| 585 | .get = alc_gpio_data_get, \ |
| 586 | .put = alc_gpio_data_put, \ |
| 587 | .private_value = nid | (mask<<16) } |
| 588 | #endif /* CONFIG_SND_DEBUG */ |
| 589 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 590 | /* A switch control to allow the enabling of the digital IO pins on the |
| 591 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 592 | * to provide something in the test model allowing digital outputs to be |
| 593 | * identified if present. If models are found which can utilise these |
| 594 | * outputs a more complete mixer control can be devised for those models if |
| 595 | * necessary. |
| 596 | */ |
| 597 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 598 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 599 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 600 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 601 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 602 | { |
| 603 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 604 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 605 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 606 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 607 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 608 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 609 | |
| 610 | *valp = (val & mask) != 0; |
| 611 | return 0; |
| 612 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 613 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 614 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 615 | { |
| 616 | signed int change; |
| 617 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 618 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 619 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 620 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 621 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 622 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 623 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 624 | |
| 625 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 626 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 627 | if (val==0) |
| 628 | ctrl_data &= ~mask; |
| 629 | else |
| 630 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 631 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 632 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 633 | |
| 634 | return change; |
| 635 | } |
| 636 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 637 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 638 | .info = alc_spdif_ctrl_info, \ |
| 639 | .get = alc_spdif_ctrl_get, \ |
| 640 | .put = alc_spdif_ctrl_put, \ |
| 641 | .private_value = nid | (mask<<16) } |
| 642 | #endif /* CONFIG_SND_DEBUG */ |
| 643 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 644 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 645 | * Again, this is only used in the ALC26x test models to help identify when |
| 646 | * the EAPD line must be asserted for features to work. |
| 647 | */ |
| 648 | #ifdef CONFIG_SND_DEBUG |
| 649 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 650 | |
| 651 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 652 | struct snd_ctl_elem_value *ucontrol) |
| 653 | { |
| 654 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 655 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 656 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 657 | long *valp = ucontrol->value.integer.value; |
| 658 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 659 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 660 | |
| 661 | *valp = (val & mask) != 0; |
| 662 | return 0; |
| 663 | } |
| 664 | |
| 665 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 666 | struct snd_ctl_elem_value *ucontrol) |
| 667 | { |
| 668 | int change; |
| 669 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 670 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 671 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 672 | long val = *ucontrol->value.integer.value; |
| 673 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 674 | AC_VERB_GET_EAPD_BTLENABLE, |
| 675 | 0x00); |
| 676 | |
| 677 | /* Set/unset the masked control bit(s) as needed */ |
| 678 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 679 | if (!val) |
| 680 | ctrl_data &= ~mask; |
| 681 | else |
| 682 | ctrl_data |= mask; |
| 683 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 684 | ctrl_data); |
| 685 | |
| 686 | return change; |
| 687 | } |
| 688 | |
| 689 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 690 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 691 | .info = alc_eapd_ctrl_info, \ |
| 692 | .get = alc_eapd_ctrl_get, \ |
| 693 | .put = alc_eapd_ctrl_put, \ |
| 694 | .private_value = nid | (mask<<16) } |
| 695 | #endif /* CONFIG_SND_DEBUG */ |
| 696 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 697 | /* |
| 698 | * set up from the preset table |
| 699 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 700 | static void setup_preset(struct alc_spec *spec, |
| 701 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 702 | { |
| 703 | int i; |
| 704 | |
| 705 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 706 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 707 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 708 | i++) |
| 709 | spec->init_verbs[spec->num_init_verbs++] = |
| 710 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 711 | |
| 712 | spec->channel_mode = preset->channel_mode; |
| 713 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 714 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 715 | |
| 716 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 717 | |
| 718 | spec->multiout.num_dacs = preset->num_dacs; |
| 719 | spec->multiout.dac_nids = preset->dac_nids; |
| 720 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 721 | spec->multiout.hp_nid = preset->hp_nid; |
| 722 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 723 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 724 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 725 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 726 | spec->input_mux = preset->input_mux; |
| 727 | |
| 728 | spec->num_adc_nids = preset->num_adc_nids; |
| 729 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 730 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 731 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 732 | |
| 733 | spec->unsol_event = preset->unsol_event; |
| 734 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 735 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 736 | spec->loopback.amplist = preset->loopbacks; |
| 737 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 738 | } |
| 739 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 740 | /* Enable GPIO mask and set output */ |
| 741 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 742 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 743 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 744 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 745 | { } |
| 746 | }; |
| 747 | |
| 748 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 749 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 750 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 751 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 752 | { } |
| 753 | }; |
| 754 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 755 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 756 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 757 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 758 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 759 | { } |
| 760 | }; |
| 761 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 762 | /* |
| 763 | * Fix hardware PLL issue |
| 764 | * On some codecs, the analog PLL gating control must be off while |
| 765 | * the default value is 1. |
| 766 | */ |
| 767 | static void alc_fix_pll(struct hda_codec *codec) |
| 768 | { |
| 769 | struct alc_spec *spec = codec->spec; |
| 770 | unsigned int val; |
| 771 | |
| 772 | if (!spec->pll_nid) |
| 773 | return; |
| 774 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 775 | spec->pll_coef_idx); |
| 776 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 777 | AC_VERB_GET_PROC_COEF, 0); |
| 778 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 779 | spec->pll_coef_idx); |
| 780 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 781 | val & ~(1 << spec->pll_coef_bit)); |
| 782 | } |
| 783 | |
| 784 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 785 | unsigned int coef_idx, unsigned int coef_bit) |
| 786 | { |
| 787 | struct alc_spec *spec = codec->spec; |
| 788 | spec->pll_nid = nid; |
| 789 | spec->pll_coef_idx = coef_idx; |
| 790 | spec->pll_coef_bit = coef_bit; |
| 791 | alc_fix_pll(codec); |
| 792 | } |
| 793 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 794 | static void alc_sku_automute(struct hda_codec *codec) |
| 795 | { |
| 796 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 797 | unsigned int present; |
| 798 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 799 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 800 | |
| 801 | /* need to execute and sync at first */ |
| 802 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 803 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 804 | AC_VERB_GET_PIN_SENSE, 0); |
| 805 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 806 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 807 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 808 | } |
| 809 | |
| 810 | /* unsolicited event for HP jack sensing */ |
| 811 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 812 | { |
| 813 | if (codec->vendor_id == 0x10ec0880) |
| 814 | res >>= 28; |
| 815 | else |
| 816 | res >>= 26; |
| 817 | if (res != ALC880_HP_EVENT) |
| 818 | return; |
| 819 | |
| 820 | alc_sku_automute(codec); |
| 821 | } |
| 822 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 823 | /* additional initialization for ALC888 variants */ |
| 824 | static void alc888_coef_init(struct hda_codec *codec) |
| 825 | { |
| 826 | unsigned int tmp; |
| 827 | |
| 828 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 829 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 830 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 831 | if ((tmp & 0xf0) == 2) |
| 832 | /* alc888S-VC */ |
| 833 | snd_hda_codec_read(codec, 0x20, 0, |
| 834 | AC_VERB_SET_PROC_COEF, 0x830); |
| 835 | else |
| 836 | /* alc888-VB */ |
| 837 | snd_hda_codec_read(codec, 0x20, 0, |
| 838 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 839 | } |
| 840 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 841 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 842 | * 31 ~ 16 : Manufacture ID |
| 843 | * 15 ~ 8 : SKU ID |
| 844 | * 7 ~ 0 : Assembly ID |
| 845 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 846 | */ |
| 847 | static void alc_subsystem_id(struct hda_codec *codec, |
| 848 | unsigned int porta, unsigned int porte, |
| 849 | unsigned int portd) |
| 850 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 851 | unsigned int ass, tmp, i; |
| 852 | unsigned nid; |
| 853 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 854 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 855 | ass = codec->subsystem_id & 0xffff; |
| 856 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 857 | goto do_sku; |
| 858 | |
| 859 | /* |
| 860 | * 31~30 : port conetcivity |
| 861 | * 29~21 : reserve |
| 862 | * 20 : PCBEEP input |
| 863 | * 19~16 : Check sum (15:1) |
| 864 | * 15~1 : Custom |
| 865 | * 0 : override |
| 866 | */ |
| 867 | nid = 0x1d; |
| 868 | if (codec->vendor_id == 0x10ec0260) |
| 869 | nid = 0x17; |
| 870 | ass = snd_hda_codec_read(codec, nid, 0, |
| 871 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 872 | if (!(ass & 1) && !(ass & 0x100000)) |
| 873 | return; |
| 874 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 875 | return; |
| 876 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 877 | /* check sum */ |
| 878 | tmp = 0; |
| 879 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 880 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 881 | tmp++; |
| 882 | } |
| 883 | if (((ass >> 16) & 0xf) != tmp) |
| 884 | return; |
| 885 | do_sku: |
| 886 | /* |
| 887 | * 0 : override |
| 888 | * 1 : Swap Jack |
| 889 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 890 | * 3~5 : External Amplifier control |
| 891 | * 7~6 : Reserved |
| 892 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 893 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 894 | switch (tmp) { |
| 895 | case 1: |
| 896 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 897 | break; |
| 898 | case 3: |
| 899 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 900 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 901 | case 7: |
| 902 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 903 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 904 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 905 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 906 | case 0x10ec0260: |
| 907 | snd_hda_codec_write(codec, 0x0f, 0, |
| 908 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 909 | snd_hda_codec_write(codec, 0x10, 0, |
| 910 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 911 | break; |
| 912 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 913 | case 0x10ec0267: |
| 914 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 915 | case 0x10ec0269: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 916 | case 0x10ec0660: |
| 917 | case 0x10ec0662: |
| 918 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 919 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 920 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 921 | snd_hda_codec_write(codec, 0x14, 0, |
| 922 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 923 | snd_hda_codec_write(codec, 0x15, 0, |
| 924 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 925 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 926 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 927 | switch (codec->vendor_id) { |
| 928 | case 0x10ec0260: |
| 929 | snd_hda_codec_write(codec, 0x1a, 0, |
| 930 | AC_VERB_SET_COEF_INDEX, 7); |
| 931 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 932 | AC_VERB_GET_PROC_COEF, 0); |
| 933 | snd_hda_codec_write(codec, 0x1a, 0, |
| 934 | AC_VERB_SET_COEF_INDEX, 7); |
| 935 | snd_hda_codec_write(codec, 0x1a, 0, |
| 936 | AC_VERB_SET_PROC_COEF, |
| 937 | tmp | 0x2010); |
| 938 | break; |
| 939 | case 0x10ec0262: |
| 940 | case 0x10ec0880: |
| 941 | case 0x10ec0882: |
| 942 | case 0x10ec0883: |
| 943 | case 0x10ec0885: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 944 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 945 | snd_hda_codec_write(codec, 0x20, 0, |
| 946 | AC_VERB_SET_COEF_INDEX, 7); |
| 947 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 948 | AC_VERB_GET_PROC_COEF, 0); |
| 949 | snd_hda_codec_write(codec, 0x20, 0, |
| 950 | AC_VERB_SET_COEF_INDEX, 7); |
| 951 | snd_hda_codec_write(codec, 0x20, 0, |
| 952 | AC_VERB_SET_PROC_COEF, |
| 953 | tmp | 0x2010); |
| 954 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 955 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 956 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 957 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 958 | case 0x10ec0267: |
| 959 | case 0x10ec0268: |
| 960 | snd_hda_codec_write(codec, 0x20, 0, |
| 961 | AC_VERB_SET_COEF_INDEX, 7); |
| 962 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 963 | AC_VERB_GET_PROC_COEF, 0); |
| 964 | snd_hda_codec_write(codec, 0x20, 0, |
| 965 | AC_VERB_SET_COEF_INDEX, 7); |
| 966 | snd_hda_codec_write(codec, 0x20, 0, |
| 967 | AC_VERB_SET_PROC_COEF, |
| 968 | tmp | 0x3000); |
| 969 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 970 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 971 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 972 | break; |
| 973 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 974 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 975 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 976 | * when the external headphone out jack is plugged" |
| 977 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 978 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 979 | return; |
| 980 | /* |
| 981 | * 10~8 : Jack location |
| 982 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 983 | * 14~13: Resvered |
| 984 | * 15 : 1 --> enable the function "Mute internal speaker |
| 985 | * when the external headphone out jack is plugged" |
| 986 | */ |
| 987 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 988 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 989 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 990 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 991 | else |
| 992 | return; |
| 993 | } |
| 994 | |
| 995 | if (!spec->autocfg.hp_pins[0]) { |
| 996 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 997 | if (tmp == 0) |
| 998 | spec->autocfg.hp_pins[0] = porta; |
| 999 | else if (tmp == 1) |
| 1000 | spec->autocfg.hp_pins[0] = porte; |
| 1001 | else if (tmp == 2) |
| 1002 | spec->autocfg.hp_pins[0] = portd; |
| 1003 | else |
| 1004 | return; |
| 1005 | } |
| 1006 | |
| 1007 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1008 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1009 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1010 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1011 | } |
| 1012 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1013 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1014 | * Fix-up pin default configurations |
| 1015 | */ |
| 1016 | |
| 1017 | struct alc_pincfg { |
| 1018 | hda_nid_t nid; |
| 1019 | u32 val; |
| 1020 | }; |
| 1021 | |
| 1022 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1023 | const struct snd_pci_quirk *quirk, |
| 1024 | const struct alc_pincfg **pinfix) |
| 1025 | { |
| 1026 | const struct alc_pincfg *cfg; |
| 1027 | |
| 1028 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1029 | if (!quirk) |
| 1030 | return; |
| 1031 | |
| 1032 | cfg = pinfix[quirk->value]; |
| 1033 | for (; cfg->nid; cfg++) { |
| 1034 | int i; |
| 1035 | u32 val = cfg->val; |
| 1036 | for (i = 0; i < 4; i++) { |
| 1037 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1038 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1039 | val & 0xff); |
| 1040 | val >>= 8; |
| 1041 | } |
| 1042 | } |
| 1043 | } |
| 1044 | |
| 1045 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1046 | * ALC880 3-stack model |
| 1047 | * |
| 1048 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1049 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1050 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1051 | */ |
| 1052 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1053 | static hda_nid_t alc880_dac_nids[4] = { |
| 1054 | /* front, rear, clfe, rear_surr */ |
| 1055 | 0x02, 0x05, 0x04, 0x03 |
| 1056 | }; |
| 1057 | |
| 1058 | static hda_nid_t alc880_adc_nids[3] = { |
| 1059 | /* ADC0-2 */ |
| 1060 | 0x07, 0x08, 0x09, |
| 1061 | }; |
| 1062 | |
| 1063 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1064 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1065 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1066 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1067 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1068 | /* ADC1-2 */ |
| 1069 | 0x08, 0x09, |
| 1070 | }; |
| 1071 | |
| 1072 | #define ALC880_DIGOUT_NID 0x06 |
| 1073 | #define ALC880_DIGIN_NID 0x0a |
| 1074 | |
| 1075 | static struct hda_input_mux alc880_capture_source = { |
| 1076 | .num_items = 4, |
| 1077 | .items = { |
| 1078 | { "Mic", 0x0 }, |
| 1079 | { "Front Mic", 0x3 }, |
| 1080 | { "Line", 0x2 }, |
| 1081 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1082 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1083 | }; |
| 1084 | |
| 1085 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1086 | /* 2ch mode */ |
| 1087 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1088 | /* set line-in to input, mute it */ |
| 1089 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1090 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1091 | /* set mic-in to input vref 80%, mute it */ |
| 1092 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1093 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1094 | { } /* end */ |
| 1095 | }; |
| 1096 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1097 | /* 6ch mode */ |
| 1098 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1099 | /* set line-in to output, unmute it */ |
| 1100 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1101 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1102 | /* set mic-in to output, unmute it */ |
| 1103 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1104 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1105 | { } /* end */ |
| 1106 | }; |
| 1107 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1108 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1109 | { 2, alc880_threestack_ch2_init }, |
| 1110 | { 6, alc880_threestack_ch6_init }, |
| 1111 | }; |
| 1112 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1113 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1114 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1115 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1116 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1117 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1118 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1119 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1120 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1121 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1122 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1123 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1124 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1125 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1126 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1127 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1128 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1129 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1130 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1131 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1132 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1133 | { |
| 1134 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1135 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1136 | .info = alc_ch_mode_info, |
| 1137 | .get = alc_ch_mode_get, |
| 1138 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1139 | }, |
| 1140 | { } /* end */ |
| 1141 | }; |
| 1142 | |
| 1143 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1144 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1145 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1146 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1147 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1148 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1149 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1150 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1151 | { |
| 1152 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1153 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1154 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1155 | */ |
| 1156 | /* .name = "Capture Source", */ |
| 1157 | .name = "Input Source", |
| 1158 | .count = 3, |
| 1159 | .info = alc_mux_enum_info, |
| 1160 | .get = alc_mux_enum_get, |
| 1161 | .put = alc_mux_enum_put, |
| 1162 | }, |
| 1163 | { } /* end */ |
| 1164 | }; |
| 1165 | |
| 1166 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1167 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1168 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1169 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1170 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1171 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1172 | { |
| 1173 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1174 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1175 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1176 | */ |
| 1177 | /* .name = "Capture Source", */ |
| 1178 | .name = "Input Source", |
| 1179 | .count = 2, |
| 1180 | .info = alc_mux_enum_info, |
| 1181 | .get = alc_mux_enum_get, |
| 1182 | .put = alc_mux_enum_put, |
| 1183 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1184 | { } /* end */ |
| 1185 | }; |
| 1186 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1187 | |
| 1188 | |
| 1189 | /* |
| 1190 | * ALC880 5-stack model |
| 1191 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1192 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1193 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1194 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1195 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1196 | */ |
| 1197 | |
| 1198 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1199 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1200 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1201 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1202 | { } /* end */ |
| 1203 | }; |
| 1204 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1205 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1206 | /* 6ch mode */ |
| 1207 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1208 | /* set line-in to input, mute it */ |
| 1209 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1210 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1211 | { } /* end */ |
| 1212 | }; |
| 1213 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1214 | /* 8ch mode */ |
| 1215 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1216 | /* set line-in to output, unmute it */ |
| 1217 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1218 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1219 | { } /* end */ |
| 1220 | }; |
| 1221 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1222 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1223 | { 6, alc880_fivestack_ch6_init }, |
| 1224 | { 8, alc880_fivestack_ch8_init }, |
| 1225 | }; |
| 1226 | |
| 1227 | |
| 1228 | /* |
| 1229 | * ALC880 6-stack model |
| 1230 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1231 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1232 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1233 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1234 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1235 | */ |
| 1236 | |
| 1237 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1238 | /* front, rear, clfe, rear_surr */ |
| 1239 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1240 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1241 | |
| 1242 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1243 | .num_items = 4, |
| 1244 | .items = { |
| 1245 | { "Mic", 0x0 }, |
| 1246 | { "Front Mic", 0x1 }, |
| 1247 | { "Line", 0x2 }, |
| 1248 | { "CD", 0x4 }, |
| 1249 | }, |
| 1250 | }; |
| 1251 | |
| 1252 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1253 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1254 | { 8, NULL }, |
| 1255 | }; |
| 1256 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1257 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1258 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1259 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1260 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1261 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1262 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1263 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1264 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1265 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1266 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1267 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1268 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1269 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1270 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1271 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1272 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1273 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1274 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1275 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1276 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1277 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1278 | { |
| 1279 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1280 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1281 | .info = alc_ch_mode_info, |
| 1282 | .get = alc_ch_mode_get, |
| 1283 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1284 | }, |
| 1285 | { } /* end */ |
| 1286 | }; |
| 1287 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1288 | |
| 1289 | /* |
| 1290 | * ALC880 W810 model |
| 1291 | * |
| 1292 | * W810 has rear IO for: |
| 1293 | * Front (DAC 02) |
| 1294 | * Surround (DAC 03) |
| 1295 | * Center/LFE (DAC 04) |
| 1296 | * Digital out (06) |
| 1297 | * |
| 1298 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1299 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1300 | * |
| 1301 | * There is a variable resistor to control the speaker or headphone |
| 1302 | * volume. This is a hardware-only device without a software API. |
| 1303 | * |
| 1304 | * Plugging headphones in will disable the internal speakers. This is |
| 1305 | * implemented in hardware, not via the driver using jack sense. In |
| 1306 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1307 | * disable both the speakers and headphones. |
| 1308 | * |
| 1309 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1310 | * These may not do anything useful with this driver yet, because I |
| 1311 | * haven't setup any initialization verbs for these yet... |
| 1312 | */ |
| 1313 | |
| 1314 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1315 | /* front, rear/surround, clfe */ |
| 1316 | 0x02, 0x03, 0x04 |
| 1317 | }; |
| 1318 | |
| 1319 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1320 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1321 | { 6, NULL } |
| 1322 | }; |
| 1323 | |
| 1324 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1325 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1326 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1327 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1328 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1329 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1330 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1331 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1332 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1333 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1334 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1335 | { } /* end */ |
| 1336 | }; |
| 1337 | |
| 1338 | |
| 1339 | /* |
| 1340 | * Z710V model |
| 1341 | * |
| 1342 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1343 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1344 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1345 | */ |
| 1346 | |
| 1347 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1348 | 0x02 |
| 1349 | }; |
| 1350 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1351 | |
| 1352 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1353 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1354 | { 2, NULL } |
| 1355 | }; |
| 1356 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1357 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1358 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1359 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1360 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1361 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1362 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1363 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1364 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1365 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1366 | { } /* end */ |
| 1367 | }; |
| 1368 | |
| 1369 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1370 | /* |
| 1371 | * ALC880 F1734 model |
| 1372 | * |
| 1373 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1374 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1375 | */ |
| 1376 | |
| 1377 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1378 | 0x03 |
| 1379 | }; |
| 1380 | #define ALC880_F1734_HP_DAC 0x02 |
| 1381 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1382 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1383 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1384 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1385 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1386 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1387 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1388 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1389 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1390 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1391 | { } /* end */ |
| 1392 | }; |
| 1393 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1394 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1395 | .num_items = 2, |
| 1396 | .items = { |
| 1397 | { "Mic", 0x1 }, |
| 1398 | { "CD", 0x4 }, |
| 1399 | }, |
| 1400 | }; |
| 1401 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1402 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1403 | /* |
| 1404 | * ALC880 ASUS model |
| 1405 | * |
| 1406 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1407 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1408 | * Mic = 0x18, Line = 0x1a |
| 1409 | */ |
| 1410 | |
| 1411 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1412 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1413 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1414 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1415 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1416 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1417 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1418 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1419 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1420 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1421 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1422 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1423 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1424 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1425 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1426 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1427 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1428 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1429 | { |
| 1430 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1431 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1432 | .info = alc_ch_mode_info, |
| 1433 | .get = alc_ch_mode_get, |
| 1434 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1435 | }, |
| 1436 | { } /* end */ |
| 1437 | }; |
| 1438 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1439 | /* |
| 1440 | * ALC880 ASUS W1V model |
| 1441 | * |
| 1442 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1443 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1444 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1445 | */ |
| 1446 | |
| 1447 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1448 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1449 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1450 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1451 | { } /* end */ |
| 1452 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1453 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1454 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1455 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1456 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1457 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1458 | { } /* end */ |
| 1459 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1460 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1461 | /* TCL S700 */ |
| 1462 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1463 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1464 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1465 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1466 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1467 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1468 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1470 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1471 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1472 | { |
| 1473 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1474 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1475 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1476 | */ |
| 1477 | /* .name = "Capture Source", */ |
| 1478 | .name = "Input Source", |
| 1479 | .count = 1, |
| 1480 | .info = alc_mux_enum_info, |
| 1481 | .get = alc_mux_enum_get, |
| 1482 | .put = alc_mux_enum_put, |
| 1483 | }, |
| 1484 | { } /* end */ |
| 1485 | }; |
| 1486 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1487 | /* Uniwill */ |
| 1488 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1489 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1490 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1491 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1492 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1493 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1494 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1495 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1496 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1497 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1498 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1499 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1500 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1503 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1504 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1505 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1506 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1507 | { |
| 1508 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1509 | .name = "Channel Mode", |
| 1510 | .info = alc_ch_mode_info, |
| 1511 | .get = alc_ch_mode_get, |
| 1512 | .put = alc_ch_mode_put, |
| 1513 | }, |
| 1514 | { } /* end */ |
| 1515 | }; |
| 1516 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1517 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1518 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1519 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1520 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1521 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1522 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1523 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1524 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1525 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1526 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1527 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1528 | { } /* end */ |
| 1529 | }; |
| 1530 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1531 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1532 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1533 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1534 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1535 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1536 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1537 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1538 | { } /* end */ |
| 1539 | }; |
| 1540 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1541 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1542 | * virtual master controls |
| 1543 | */ |
| 1544 | |
| 1545 | /* |
| 1546 | * slave controls for virtual master |
| 1547 | */ |
| 1548 | static const char *alc_slave_vols[] = { |
| 1549 | "Front Playback Volume", |
| 1550 | "Surround Playback Volume", |
| 1551 | "Center Playback Volume", |
| 1552 | "LFE Playback Volume", |
| 1553 | "Side Playback Volume", |
| 1554 | "Headphone Playback Volume", |
| 1555 | "Speaker Playback Volume", |
| 1556 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1557 | "Line-Out Playback Volume", |
| 1558 | NULL, |
| 1559 | }; |
| 1560 | |
| 1561 | static const char *alc_slave_sws[] = { |
| 1562 | "Front Playback Switch", |
| 1563 | "Surround Playback Switch", |
| 1564 | "Center Playback Switch", |
| 1565 | "LFE Playback Switch", |
| 1566 | "Side Playback Switch", |
| 1567 | "Headphone Playback Switch", |
| 1568 | "Speaker Playback Switch", |
| 1569 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1570 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1571 | NULL, |
| 1572 | }; |
| 1573 | |
| 1574 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1575 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1576 | */ |
| 1577 | static int alc_build_controls(struct hda_codec *codec) |
| 1578 | { |
| 1579 | struct alc_spec *spec = codec->spec; |
| 1580 | int err; |
| 1581 | int i; |
| 1582 | |
| 1583 | for (i = 0; i < spec->num_mixers; i++) { |
| 1584 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1585 | if (err < 0) |
| 1586 | return err; |
| 1587 | } |
| 1588 | |
| 1589 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1590 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1591 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1592 | if (err < 0) |
| 1593 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1594 | err = snd_hda_create_spdif_share_sw(codec, |
| 1595 | &spec->multiout); |
| 1596 | if (err < 0) |
| 1597 | return err; |
| 1598 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1599 | } |
| 1600 | if (spec->dig_in_nid) { |
| 1601 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1602 | if (err < 0) |
| 1603 | return err; |
| 1604 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1605 | |
| 1606 | /* if we have no master control, let's create it */ |
| 1607 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1608 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1609 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1610 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1611 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1612 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1613 | if (err < 0) |
| 1614 | return err; |
| 1615 | } |
| 1616 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1617 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1618 | NULL, alc_slave_sws); |
| 1619 | if (err < 0) |
| 1620 | return err; |
| 1621 | } |
| 1622 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1623 | return 0; |
| 1624 | } |
| 1625 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1626 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1627 | /* |
| 1628 | * initialize the codec volumes, etc |
| 1629 | */ |
| 1630 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1631 | /* |
| 1632 | * generic initialization of ADC, input mixers and output mixers |
| 1633 | */ |
| 1634 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1635 | /* |
| 1636 | * Unmute ADC0-2 and set the default input to mic-in |
| 1637 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1638 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1639 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1640 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1641 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1642 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1643 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1644 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1645 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1646 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1647 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1648 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1649 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1650 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1651 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1652 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1653 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1654 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1655 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1656 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1657 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1658 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1659 | /* |
| 1660 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1661 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1662 | /* set vol=0 to output mixers */ |
| 1663 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1664 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1665 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1666 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1667 | /* set up input amps for analog loopback */ |
| 1668 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1669 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1670 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1671 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1672 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1673 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1674 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1675 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1676 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1677 | |
| 1678 | { } |
| 1679 | }; |
| 1680 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1681 | /* |
| 1682 | * 3-stack pin configuration: |
| 1683 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1684 | */ |
| 1685 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1686 | /* |
| 1687 | * preset connection lists of input pins |
| 1688 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1689 | */ |
| 1690 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1691 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1692 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1693 | |
| 1694 | /* |
| 1695 | * Set pin mode and muting |
| 1696 | */ |
| 1697 | /* set front pin widgets 0x14 for output */ |
| 1698 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1699 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1700 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1701 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1702 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1703 | /* Mic2 (as headphone out) for HP output */ |
| 1704 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1705 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1706 | /* Line In pin widget for input */ |
| 1707 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1708 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1709 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1710 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1711 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1712 | /* CD pin widget for input */ |
| 1713 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1714 | |
| 1715 | { } |
| 1716 | }; |
| 1717 | |
| 1718 | /* |
| 1719 | * 5-stack pin configuration: |
| 1720 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1721 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1722 | */ |
| 1723 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1724 | /* |
| 1725 | * preset connection lists of input pins |
| 1726 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1727 | */ |
| 1728 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1729 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1730 | |
| 1731 | /* |
| 1732 | * Set pin mode and muting |
| 1733 | */ |
| 1734 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1735 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1736 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1737 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1738 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1739 | /* unmute pins for output (no gain on this amp) */ |
| 1740 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1742 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1743 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1744 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1745 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1746 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1747 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1748 | /* Mic2 (as headphone out) for HP output */ |
| 1749 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1750 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1751 | /* Line In pin widget for input */ |
| 1752 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1753 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1754 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1755 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1756 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1757 | /* CD pin widget for input */ |
| 1758 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1759 | |
| 1760 | { } |
| 1761 | }; |
| 1762 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1763 | /* |
| 1764 | * W810 pin configuration: |
| 1765 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1766 | */ |
| 1767 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1768 | /* hphone/speaker input selector: front DAC */ |
| 1769 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1770 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1771 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1772 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1773 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1775 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1776 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1777 | |
| 1778 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1779 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1780 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1781 | { } |
| 1782 | }; |
| 1783 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1784 | /* |
| 1785 | * Z71V pin configuration: |
| 1786 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1787 | */ |
| 1788 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1789 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1790 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1791 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1792 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1793 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1794 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1795 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1796 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1797 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1798 | |
| 1799 | { } |
| 1800 | }; |
| 1801 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1802 | /* |
| 1803 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1804 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1805 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1806 | */ |
| 1807 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1808 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1809 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1810 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1811 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1812 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1813 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1814 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1815 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1816 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1817 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1818 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1819 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1820 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1821 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1822 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1823 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1824 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1825 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1826 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1827 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1828 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1829 | { } |
| 1830 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1831 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1832 | /* |
| 1833 | * Uniwill pin configuration: |
| 1834 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1835 | * line = 0x1a |
| 1836 | */ |
| 1837 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1838 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1839 | |
| 1840 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1841 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1842 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1843 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1844 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1845 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1846 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1847 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1848 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1849 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1850 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1851 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1852 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1853 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1854 | |
| 1855 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1856 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1857 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1858 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1859 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1860 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1861 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1862 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1863 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1864 | |
| 1865 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1866 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1867 | |
| 1868 | { } |
| 1869 | }; |
| 1870 | |
| 1871 | /* |
| 1872 | * Uniwill P53 |
| 1873 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1874 | */ |
| 1875 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1876 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1877 | |
| 1878 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1879 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1880 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1881 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1882 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1883 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1884 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1886 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1887 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1888 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1889 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1890 | |
| 1891 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1892 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1893 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1894 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1895 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1896 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1897 | |
| 1898 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1899 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1900 | |
| 1901 | { } |
| 1902 | }; |
| 1903 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1904 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1905 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1906 | { } |
| 1907 | }; |
| 1908 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1909 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1910 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1911 | { |
| 1912 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1913 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1914 | |
| 1915 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1916 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1917 | bits = present ? HDA_AMP_MUTE : 0; |
| 1918 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1919 | HDA_AMP_MUTE, bits); |
| 1920 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1921 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1922 | } |
| 1923 | |
| 1924 | /* auto-toggle front mic */ |
| 1925 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1926 | { |
| 1927 | unsigned int present; |
| 1928 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1929 | |
| 1930 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1931 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1932 | bits = present ? HDA_AMP_MUTE : 0; |
| 1933 | 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] | 1934 | } |
| 1935 | |
| 1936 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1937 | { |
| 1938 | alc880_uniwill_hp_automute(codec); |
| 1939 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1940 | } |
| 1941 | |
| 1942 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1943 | unsigned int res) |
| 1944 | { |
| 1945 | /* Looks like the unsol event is incompatible with the standard |
| 1946 | * definition. 4bit tag is placed at 28 bit! |
| 1947 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1948 | switch (res >> 28) { |
| 1949 | case ALC880_HP_EVENT: |
| 1950 | alc880_uniwill_hp_automute(codec); |
| 1951 | break; |
| 1952 | case ALC880_MIC_EVENT: |
| 1953 | alc880_uniwill_mic_automute(codec); |
| 1954 | break; |
| 1955 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1956 | } |
| 1957 | |
| 1958 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1959 | { |
| 1960 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1961 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1962 | |
| 1963 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1964 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1965 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 1966 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1967 | } |
| 1968 | |
| 1969 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1970 | { |
| 1971 | unsigned int present; |
| 1972 | |
| 1973 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1974 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1975 | present &= HDA_AMP_VOLMASK; |
| 1976 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1977 | HDA_AMP_VOLMASK, present); |
| 1978 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1979 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1980 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1981 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1982 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1983 | unsigned int res) |
| 1984 | { |
| 1985 | /* Looks like the unsol event is incompatible with the standard |
| 1986 | * definition. 4bit tag is placed at 28 bit! |
| 1987 | */ |
| 1988 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1989 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1990 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1991 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1992 | } |
| 1993 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1994 | /* |
| 1995 | * F1734 pin configuration: |
| 1996 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1997 | */ |
| 1998 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1999 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2000 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2001 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2002 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2003 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2004 | |
| 2005 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2006 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2007 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2008 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2009 | |
| 2010 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2011 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2012 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2013 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2014 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2015 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2016 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2017 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2018 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2019 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2020 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2021 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2022 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2023 | { } |
| 2024 | }; |
| 2025 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2026 | /* |
| 2027 | * ASUS pin configuration: |
| 2028 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2029 | */ |
| 2030 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2031 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2032 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2033 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2034 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2035 | |
| 2036 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2037 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2038 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2039 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2040 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2041 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2042 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2043 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2044 | |
| 2045 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2046 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2047 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2048 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2049 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2050 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2051 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2052 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2053 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2054 | |
| 2055 | { } |
| 2056 | }; |
| 2057 | |
| 2058 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2059 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2060 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2061 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2062 | /* Clevo m520g init */ |
| 2063 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2064 | /* headphone output */ |
| 2065 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2066 | /* line-out */ |
| 2067 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2068 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2069 | /* Line-in */ |
| 2070 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2071 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2072 | /* CD */ |
| 2073 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2074 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2075 | /* Mic1 (rear panel) */ |
| 2076 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2077 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2078 | /* Mic2 (front panel) */ |
| 2079 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2080 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2081 | /* headphone */ |
| 2082 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2083 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2084 | /* change to EAPD mode */ |
| 2085 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2086 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2087 | |
| 2088 | { } |
| 2089 | }; |
| 2090 | |
| 2091 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2092 | /* change to EAPD mode */ |
| 2093 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2094 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2095 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2096 | /* Headphone output */ |
| 2097 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2098 | /* Front output*/ |
| 2099 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2100 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2101 | |
| 2102 | /* Line In pin widget for input */ |
| 2103 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2104 | /* CD pin widget for input */ |
| 2105 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2106 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2107 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2108 | |
| 2109 | /* change to EAPD mode */ |
| 2110 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2111 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2112 | |
| 2113 | { } |
| 2114 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2115 | |
| 2116 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2117 | * LG m1 express dual |
| 2118 | * |
| 2119 | * Pin assignment: |
| 2120 | * Rear Line-In/Out (blue): 0x14 |
| 2121 | * Build-in Mic-In: 0x15 |
| 2122 | * Speaker-out: 0x17 |
| 2123 | * HP-Out (green): 0x1b |
| 2124 | * Mic-In/Out (red): 0x19 |
| 2125 | * SPDIF-Out: 0x1e |
| 2126 | */ |
| 2127 | |
| 2128 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2129 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2130 | 0x05, 0x02, 0x03 |
| 2131 | }; |
| 2132 | |
| 2133 | /* seems analog CD is not working */ |
| 2134 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2135 | .num_items = 3, |
| 2136 | .items = { |
| 2137 | { "Mic", 0x1 }, |
| 2138 | { "Line", 0x5 }, |
| 2139 | { "Internal Mic", 0x6 }, |
| 2140 | }, |
| 2141 | }; |
| 2142 | |
| 2143 | /* 2,4,6 channel modes */ |
| 2144 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2145 | /* set line-in and mic-in to input */ |
| 2146 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2147 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2148 | { } |
| 2149 | }; |
| 2150 | |
| 2151 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2152 | /* set line-in to out and mic-in to input */ |
| 2153 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2154 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2155 | { } |
| 2156 | }; |
| 2157 | |
| 2158 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2159 | /* set line-in and mic-in to output */ |
| 2160 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2161 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2162 | { } |
| 2163 | }; |
| 2164 | |
| 2165 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2166 | { 2, alc880_lg_ch2_init }, |
| 2167 | { 4, alc880_lg_ch4_init }, |
| 2168 | { 6, alc880_lg_ch6_init }, |
| 2169 | }; |
| 2170 | |
| 2171 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2172 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2173 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2174 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2175 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2176 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2177 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2178 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2179 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2180 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2181 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2182 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2183 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2184 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2185 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2186 | { |
| 2187 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2188 | .name = "Channel Mode", |
| 2189 | .info = alc_ch_mode_info, |
| 2190 | .get = alc_ch_mode_get, |
| 2191 | .put = alc_ch_mode_put, |
| 2192 | }, |
| 2193 | { } /* end */ |
| 2194 | }; |
| 2195 | |
| 2196 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2197 | /* set capture source to mic-in */ |
| 2198 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2199 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2200 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2201 | /* mute all amp mixer inputs */ |
| 2202 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2203 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2204 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2205 | /* line-in to input */ |
| 2206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2207 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2208 | /* built-in mic */ |
| 2209 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2210 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2211 | /* speaker-out */ |
| 2212 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2213 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2214 | /* mic-in to input */ |
| 2215 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2216 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2217 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2218 | /* HP-out */ |
| 2219 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2220 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2221 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2222 | /* jack sense */ |
| 2223 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2224 | { } |
| 2225 | }; |
| 2226 | |
| 2227 | /* toggle speaker-output according to the hp-jack state */ |
| 2228 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2229 | { |
| 2230 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2231 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2232 | |
| 2233 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2234 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2235 | bits = present ? HDA_AMP_MUTE : 0; |
| 2236 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2237 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2238 | } |
| 2239 | |
| 2240 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2241 | { |
| 2242 | /* Looks like the unsol event is incompatible with the standard |
| 2243 | * definition. 4bit tag is placed at 28 bit! |
| 2244 | */ |
| 2245 | if ((res >> 28) == 0x01) |
| 2246 | alc880_lg_automute(codec); |
| 2247 | } |
| 2248 | |
| 2249 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2250 | * LG LW20 |
| 2251 | * |
| 2252 | * Pin assignment: |
| 2253 | * Speaker-out: 0x14 |
| 2254 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2255 | * Built-in Mic-In: 0x19 |
| 2256 | * Line-In: 0x1b |
| 2257 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2258 | * SPDIF-Out: 0x1e |
| 2259 | */ |
| 2260 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2261 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2262 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2263 | .items = { |
| 2264 | { "Mic", 0x0 }, |
| 2265 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2266 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2267 | }, |
| 2268 | }; |
| 2269 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2270 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2271 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2272 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2273 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2274 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2275 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2276 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2277 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2278 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2279 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2280 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2281 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2282 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2283 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2284 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2285 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2286 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2287 | { |
| 2288 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2289 | .name = "Channel Mode", |
| 2290 | .info = alc_ch_mode_info, |
| 2291 | .get = alc_ch_mode_get, |
| 2292 | .put = alc_ch_mode_put, |
| 2293 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2294 | { } /* end */ |
| 2295 | }; |
| 2296 | |
| 2297 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2298 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2299 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2300 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2301 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2302 | /* set capture source to mic-in */ |
| 2303 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2304 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2305 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2306 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2307 | /* speaker-out */ |
| 2308 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2309 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2310 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2311 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2312 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2313 | /* mic-in to input */ |
| 2314 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2315 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2316 | /* built-in mic */ |
| 2317 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2318 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2319 | /* jack sense */ |
| 2320 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2321 | { } |
| 2322 | }; |
| 2323 | |
| 2324 | /* toggle speaker-output according to the hp-jack state */ |
| 2325 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2326 | { |
| 2327 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2328 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2329 | |
| 2330 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2331 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2332 | bits = present ? HDA_AMP_MUTE : 0; |
| 2333 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2334 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2335 | } |
| 2336 | |
| 2337 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2338 | { |
| 2339 | /* Looks like the unsol event is incompatible with the standard |
| 2340 | * definition. 4bit tag is placed at 28 bit! |
| 2341 | */ |
| 2342 | if ((res >> 28) == 0x01) |
| 2343 | alc880_lg_lw_automute(codec); |
| 2344 | } |
| 2345 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2346 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2347 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2348 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2349 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2350 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2351 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2352 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2353 | { } /* end */ |
| 2354 | }; |
| 2355 | |
| 2356 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2357 | .num_items = 2, |
| 2358 | .items = { |
| 2359 | { "Mic", 0x0 }, |
| 2360 | { "Internal Mic", 0x1 }, |
| 2361 | }, |
| 2362 | }; |
| 2363 | |
| 2364 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2365 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2366 | |
| 2367 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2368 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2369 | |
| 2370 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2371 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2372 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2373 | /* Mic2 (as headphone out) for HP output */ |
| 2374 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2375 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2376 | /* Internal Speaker */ |
| 2377 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2378 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2379 | |
| 2380 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2381 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2382 | |
| 2383 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2384 | { } |
| 2385 | }; |
| 2386 | |
| 2387 | /* toggle speaker-output according to the hp-jack state */ |
| 2388 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2389 | { |
| 2390 | unsigned int present; |
| 2391 | unsigned char bits; |
| 2392 | |
| 2393 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2394 | AC_VERB_GET_PIN_SENSE, 0) |
| 2395 | & AC_PINSENSE_PRESENCE; |
| 2396 | bits = present ? HDA_AMP_MUTE : 0; |
| 2397 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2398 | HDA_AMP_MUTE, bits); |
| 2399 | if (present) |
| 2400 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2401 | else |
| 2402 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2403 | } |
| 2404 | |
| 2405 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2406 | unsigned int res) |
| 2407 | { |
| 2408 | /* Looks like the unsol event is incompatible with the standard |
| 2409 | * definition. 4bit tag is placed at 28 bit! |
| 2410 | */ |
| 2411 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2412 | alc880_medion_rim_automute(codec); |
| 2413 | } |
| 2414 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2415 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2416 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2417 | { 0x0b, HDA_INPUT, 0 }, |
| 2418 | { 0x0b, HDA_INPUT, 1 }, |
| 2419 | { 0x0b, HDA_INPUT, 2 }, |
| 2420 | { 0x0b, HDA_INPUT, 3 }, |
| 2421 | { 0x0b, HDA_INPUT, 4 }, |
| 2422 | { } /* end */ |
| 2423 | }; |
| 2424 | |
| 2425 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2426 | { 0x0b, HDA_INPUT, 1 }, |
| 2427 | { 0x0b, HDA_INPUT, 6 }, |
| 2428 | { 0x0b, HDA_INPUT, 7 }, |
| 2429 | { } /* end */ |
| 2430 | }; |
| 2431 | #endif |
| 2432 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2433 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2434 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2435 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2436 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2437 | static int alc_init(struct hda_codec *codec) |
| 2438 | { |
| 2439 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2440 | unsigned int i; |
| 2441 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2442 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2443 | if (codec->vendor_id == 0x10ec0888) |
| 2444 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2445 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2446 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2447 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2448 | |
| 2449 | if (spec->init_hook) |
| 2450 | spec->init_hook(codec); |
| 2451 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2452 | return 0; |
| 2453 | } |
| 2454 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2455 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2456 | { |
| 2457 | struct alc_spec *spec = codec->spec; |
| 2458 | |
| 2459 | if (spec->unsol_event) |
| 2460 | spec->unsol_event(codec, res); |
| 2461 | } |
| 2462 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2463 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2464 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2465 | { |
| 2466 | struct alc_spec *spec = codec->spec; |
| 2467 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2468 | } |
| 2469 | #endif |
| 2470 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2471 | /* |
| 2472 | * Analog playback callbacks |
| 2473 | */ |
| 2474 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2475 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2476 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2477 | { |
| 2478 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2479 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2480 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2481 | } |
| 2482 | |
| 2483 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2484 | struct hda_codec *codec, |
| 2485 | unsigned int stream_tag, |
| 2486 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2487 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2488 | { |
| 2489 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2490 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2491 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2492 | } |
| 2493 | |
| 2494 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2495 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2496 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2497 | { |
| 2498 | struct alc_spec *spec = codec->spec; |
| 2499 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2500 | } |
| 2501 | |
| 2502 | /* |
| 2503 | * Digital out |
| 2504 | */ |
| 2505 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2506 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2507 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2508 | { |
| 2509 | struct alc_spec *spec = codec->spec; |
| 2510 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2511 | } |
| 2512 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2513 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2514 | struct hda_codec *codec, |
| 2515 | unsigned int stream_tag, |
| 2516 | unsigned int format, |
| 2517 | struct snd_pcm_substream *substream) |
| 2518 | { |
| 2519 | struct alc_spec *spec = codec->spec; |
| 2520 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2521 | stream_tag, format, substream); |
| 2522 | } |
| 2523 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2524 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2525 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2526 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2527 | { |
| 2528 | struct alc_spec *spec = codec->spec; |
| 2529 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2530 | } |
| 2531 | |
| 2532 | /* |
| 2533 | * Analog capture |
| 2534 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2535 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2536 | struct hda_codec *codec, |
| 2537 | unsigned int stream_tag, |
| 2538 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2539 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2540 | { |
| 2541 | struct alc_spec *spec = codec->spec; |
| 2542 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2543 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2544 | stream_tag, 0, format); |
| 2545 | return 0; |
| 2546 | } |
| 2547 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2548 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2549 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2550 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2551 | { |
| 2552 | struct alc_spec *spec = codec->spec; |
| 2553 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2554 | snd_hda_codec_cleanup_stream(codec, |
| 2555 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2556 | return 0; |
| 2557 | } |
| 2558 | |
| 2559 | |
| 2560 | /* |
| 2561 | */ |
| 2562 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2563 | .substreams = 1, |
| 2564 | .channels_min = 2, |
| 2565 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2566 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2567 | .ops = { |
| 2568 | .open = alc880_playback_pcm_open, |
| 2569 | .prepare = alc880_playback_pcm_prepare, |
| 2570 | .cleanup = alc880_playback_pcm_cleanup |
| 2571 | }, |
| 2572 | }; |
| 2573 | |
| 2574 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2575 | .substreams = 1, |
| 2576 | .channels_min = 2, |
| 2577 | .channels_max = 2, |
| 2578 | /* NID is set in alc_build_pcms */ |
| 2579 | }; |
| 2580 | |
| 2581 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2582 | .substreams = 1, |
| 2583 | .channels_min = 2, |
| 2584 | .channels_max = 2, |
| 2585 | /* NID is set in alc_build_pcms */ |
| 2586 | }; |
| 2587 | |
| 2588 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2589 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2590 | .channels_min = 2, |
| 2591 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2592 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2593 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2594 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2595 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2596 | }, |
| 2597 | }; |
| 2598 | |
| 2599 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2600 | .substreams = 1, |
| 2601 | .channels_min = 2, |
| 2602 | .channels_max = 2, |
| 2603 | /* NID is set in alc_build_pcms */ |
| 2604 | .ops = { |
| 2605 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2606 | .close = alc880_dig_playback_pcm_close, |
| 2607 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2608 | }, |
| 2609 | }; |
| 2610 | |
| 2611 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2612 | .substreams = 1, |
| 2613 | .channels_min = 2, |
| 2614 | .channels_max = 2, |
| 2615 | /* NID is set in alc_build_pcms */ |
| 2616 | }; |
| 2617 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2618 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2619 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2620 | .substreams = 0, |
| 2621 | .channels_min = 0, |
| 2622 | .channels_max = 0, |
| 2623 | }; |
| 2624 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2625 | static int alc_build_pcms(struct hda_codec *codec) |
| 2626 | { |
| 2627 | struct alc_spec *spec = codec->spec; |
| 2628 | struct hda_pcm *info = spec->pcm_rec; |
| 2629 | int i; |
| 2630 | |
| 2631 | codec->num_pcms = 1; |
| 2632 | codec->pcm_info = info; |
| 2633 | |
| 2634 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2635 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame^] | 2636 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 2637 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2638 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2639 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2640 | } |
| 2641 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame^] | 2642 | if (snd_BUG_ON(!spec->adc_nids)) |
| 2643 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2644 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2645 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2646 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2647 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2648 | if (spec->channel_mode) { |
| 2649 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2650 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2651 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2652 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2653 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2654 | } |
| 2655 | } |
| 2656 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2657 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2658 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2659 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2660 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2661 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2662 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2663 | if (spec->multiout.dig_out_nid && |
| 2664 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2665 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2666 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2667 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2668 | if (spec->dig_in_nid && |
| 2669 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2670 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2671 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2672 | } |
| 2673 | } |
| 2674 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2675 | /* If the use of more than one ADC is requested for the current |
| 2676 | * model, configure a second analog capture-only PCM. |
| 2677 | */ |
| 2678 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2679 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2680 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2681 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2682 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2683 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2684 | if (spec->alt_dac_nid) { |
| 2685 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2686 | *spec->stream_analog_alt_playback; |
| 2687 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2688 | spec->alt_dac_nid; |
| 2689 | } else { |
| 2690 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2691 | alc_pcm_null_stream; |
| 2692 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2693 | } |
| 2694 | if (spec->num_adc_nids > 1) { |
| 2695 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2696 | *spec->stream_analog_alt_capture; |
| 2697 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2698 | spec->adc_nids[1]; |
| 2699 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2700 | spec->num_adc_nids - 1; |
| 2701 | } else { |
| 2702 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2703 | alc_pcm_null_stream; |
| 2704 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2705 | } |
| 2706 | } |
| 2707 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2708 | return 0; |
| 2709 | } |
| 2710 | |
| 2711 | static void alc_free(struct hda_codec *codec) |
| 2712 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2713 | struct alc_spec *spec = codec->spec; |
| 2714 | unsigned int i; |
| 2715 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2716 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2717 | return; |
| 2718 | |
| 2719 | if (spec->kctl_alloc) { |
| 2720 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2721 | kfree(spec->kctl_alloc[i].name); |
| 2722 | kfree(spec->kctl_alloc); |
| 2723 | } |
| 2724 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2725 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2726 | } |
| 2727 | |
| 2728 | /* |
| 2729 | */ |
| 2730 | static struct hda_codec_ops alc_patch_ops = { |
| 2731 | .build_controls = alc_build_controls, |
| 2732 | .build_pcms = alc_build_pcms, |
| 2733 | .init = alc_init, |
| 2734 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2735 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2736 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2737 | .check_power_status = alc_check_power_status, |
| 2738 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2739 | }; |
| 2740 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2741 | |
| 2742 | /* |
| 2743 | * Test configuration for debugging |
| 2744 | * |
| 2745 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2746 | * enum controls. |
| 2747 | */ |
| 2748 | #ifdef CONFIG_SND_DEBUG |
| 2749 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2750 | 0x02, 0x03, 0x04, 0x05 |
| 2751 | }; |
| 2752 | |
| 2753 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2754 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2755 | .items = { |
| 2756 | { "In-1", 0x0 }, |
| 2757 | { "In-2", 0x1 }, |
| 2758 | { "In-3", 0x2 }, |
| 2759 | { "In-4", 0x3 }, |
| 2760 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2761 | { "Front", 0x5 }, |
| 2762 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2763 | }, |
| 2764 | }; |
| 2765 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2766 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2767 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2768 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2769 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2770 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2771 | }; |
| 2772 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2773 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2774 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2775 | { |
| 2776 | static char *texts[] = { |
| 2777 | "N/A", "Line Out", "HP Out", |
| 2778 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2779 | }; |
| 2780 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2781 | uinfo->count = 1; |
| 2782 | uinfo->value.enumerated.items = 8; |
| 2783 | if (uinfo->value.enumerated.item >= 8) |
| 2784 | uinfo->value.enumerated.item = 7; |
| 2785 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2786 | return 0; |
| 2787 | } |
| 2788 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2789 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2790 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2791 | { |
| 2792 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2793 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2794 | unsigned int pin_ctl, item = 0; |
| 2795 | |
| 2796 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2797 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2798 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2799 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2800 | item = 2; |
| 2801 | else |
| 2802 | item = 1; |
| 2803 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2804 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2805 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2806 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2807 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2808 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2809 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2810 | } |
| 2811 | } |
| 2812 | ucontrol->value.enumerated.item[0] = item; |
| 2813 | return 0; |
| 2814 | } |
| 2815 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2816 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2817 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2818 | { |
| 2819 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2820 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2821 | static unsigned int ctls[] = { |
| 2822 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2823 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2824 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2825 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2826 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2827 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2828 | }; |
| 2829 | unsigned int old_ctl, new_ctl; |
| 2830 | |
| 2831 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2832 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2833 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2834 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2835 | int val; |
| 2836 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2837 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2838 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2839 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2840 | HDA_AMP_MUTE : 0; |
| 2841 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2842 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2843 | return 1; |
| 2844 | } |
| 2845 | return 0; |
| 2846 | } |
| 2847 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2848 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2849 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2850 | { |
| 2851 | static char *texts[] = { |
| 2852 | "Front", "Surround", "CLFE", "Side" |
| 2853 | }; |
| 2854 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2855 | uinfo->count = 1; |
| 2856 | uinfo->value.enumerated.items = 4; |
| 2857 | if (uinfo->value.enumerated.item >= 4) |
| 2858 | uinfo->value.enumerated.item = 3; |
| 2859 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2860 | return 0; |
| 2861 | } |
| 2862 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2863 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2864 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2865 | { |
| 2866 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2867 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2868 | unsigned int sel; |
| 2869 | |
| 2870 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2871 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2872 | return 0; |
| 2873 | } |
| 2874 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2875 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2876 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2877 | { |
| 2878 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2879 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2880 | unsigned int sel; |
| 2881 | |
| 2882 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2883 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2884 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2885 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2886 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2887 | return 1; |
| 2888 | } |
| 2889 | return 0; |
| 2890 | } |
| 2891 | |
| 2892 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2893 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2894 | .name = xname, \ |
| 2895 | .info = alc_test_pin_ctl_info, \ |
| 2896 | .get = alc_test_pin_ctl_get, \ |
| 2897 | .put = alc_test_pin_ctl_put, \ |
| 2898 | .private_value = nid \ |
| 2899 | } |
| 2900 | |
| 2901 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2902 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2903 | .name = xname, \ |
| 2904 | .info = alc_test_pin_src_info, \ |
| 2905 | .get = alc_test_pin_src_get, \ |
| 2906 | .put = alc_test_pin_src_put, \ |
| 2907 | .private_value = nid \ |
| 2908 | } |
| 2909 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2910 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2911 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2912 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2913 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2914 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2915 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2916 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2917 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2918 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2919 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2920 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2921 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2922 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2923 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2924 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2925 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2926 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2927 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2928 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2929 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2930 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2931 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2932 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2933 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2934 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2935 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2936 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2937 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2938 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2939 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2940 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2941 | { |
| 2942 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2943 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2944 | .info = alc_ch_mode_info, |
| 2945 | .get = alc_ch_mode_get, |
| 2946 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2947 | }, |
| 2948 | { } /* end */ |
| 2949 | }; |
| 2950 | |
| 2951 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2952 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2953 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2954 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2955 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2956 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2957 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2958 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2959 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2960 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2961 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2962 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2963 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2964 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2965 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2966 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2967 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2968 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2969 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2970 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2971 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2972 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2973 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2974 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2975 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2976 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2977 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2978 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2979 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2980 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2981 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2982 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2983 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2984 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2985 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2986 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2987 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2988 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2989 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2990 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2991 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2992 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2993 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2994 | /* Analog input/passthru */ |
| 2995 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2996 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2997 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2998 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2999 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3000 | { } |
| 3001 | }; |
| 3002 | #endif |
| 3003 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3004 | /* |
| 3005 | */ |
| 3006 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3007 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3008 | [ALC880_3ST] = "3stack", |
| 3009 | [ALC880_TCL_S700] = "tcl", |
| 3010 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3011 | [ALC880_CLEVO] = "clevo", |
| 3012 | [ALC880_5ST] = "5stack", |
| 3013 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3014 | [ALC880_W810] = "w810", |
| 3015 | [ALC880_Z71V] = "z71v", |
| 3016 | [ALC880_6ST] = "6stack", |
| 3017 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3018 | [ALC880_ASUS] = "asus", |
| 3019 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3020 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3021 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3022 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3023 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3024 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3025 | [ALC880_F1734] = "F1734", |
| 3026 | [ALC880_LG] = "lg", |
| 3027 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3028 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3029 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3030 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3031 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3032 | [ALC880_AUTO] = "auto", |
| 3033 | }; |
| 3034 | |
| 3035 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3036 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3037 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3038 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3039 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3040 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3041 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3042 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3043 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3044 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3045 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3046 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3047 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3048 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3049 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3050 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3051 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3052 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3053 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3054 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3055 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3056 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3057 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3058 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3059 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3060 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3061 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3062 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3063 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3064 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3065 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3066 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3067 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3068 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3069 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3070 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3071 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3072 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3073 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3074 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3075 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3076 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3077 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3078 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3079 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3080 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3081 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3082 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3083 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3084 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3085 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3086 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3087 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3088 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3089 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3090 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3091 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3092 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3093 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3094 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3095 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3096 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3097 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3098 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3099 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3100 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3101 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3102 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3103 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3104 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3105 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3106 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3107 | {} |
| 3108 | }; |
| 3109 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3110 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3111 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3112 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3113 | static struct alc_config_preset alc880_presets[] = { |
| 3114 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3115 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3116 | .init_verbs = { alc880_volume_init_verbs, |
| 3117 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3118 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3119 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3120 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3121 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3122 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3123 | .input_mux = &alc880_capture_source, |
| 3124 | }, |
| 3125 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3126 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3127 | .init_verbs = { alc880_volume_init_verbs, |
| 3128 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3129 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3130 | .dac_nids = alc880_dac_nids, |
| 3131 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3132 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3133 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3134 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3135 | .input_mux = &alc880_capture_source, |
| 3136 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3137 | [ALC880_TCL_S700] = { |
| 3138 | .mixers = { alc880_tcl_s700_mixer }, |
| 3139 | .init_verbs = { alc880_volume_init_verbs, |
| 3140 | alc880_pin_tcl_S700_init_verbs, |
| 3141 | alc880_gpio2_init_verbs }, |
| 3142 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3143 | .dac_nids = alc880_dac_nids, |
| 3144 | .hp_nid = 0x03, |
| 3145 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3146 | .channel_mode = alc880_2_jack_modes, |
| 3147 | .input_mux = &alc880_capture_source, |
| 3148 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3149 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3150 | .mixers = { alc880_three_stack_mixer, |
| 3151 | alc880_five_stack_mixer}, |
| 3152 | .init_verbs = { alc880_volume_init_verbs, |
| 3153 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3154 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3155 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3156 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3157 | .channel_mode = alc880_fivestack_modes, |
| 3158 | .input_mux = &alc880_capture_source, |
| 3159 | }, |
| 3160 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3161 | .mixers = { alc880_three_stack_mixer, |
| 3162 | alc880_five_stack_mixer }, |
| 3163 | .init_verbs = { alc880_volume_init_verbs, |
| 3164 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3165 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3166 | .dac_nids = alc880_dac_nids, |
| 3167 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3168 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3169 | .channel_mode = alc880_fivestack_modes, |
| 3170 | .input_mux = &alc880_capture_source, |
| 3171 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3172 | [ALC880_6ST] = { |
| 3173 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3174 | .init_verbs = { alc880_volume_init_verbs, |
| 3175 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3176 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3177 | .dac_nids = alc880_6st_dac_nids, |
| 3178 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3179 | .channel_mode = alc880_sixstack_modes, |
| 3180 | .input_mux = &alc880_6stack_capture_source, |
| 3181 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3182 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3183 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3184 | .init_verbs = { alc880_volume_init_verbs, |
| 3185 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3186 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3187 | .dac_nids = alc880_6st_dac_nids, |
| 3188 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3189 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3190 | .channel_mode = alc880_sixstack_modes, |
| 3191 | .input_mux = &alc880_6stack_capture_source, |
| 3192 | }, |
| 3193 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3194 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3195 | .init_verbs = { alc880_volume_init_verbs, |
| 3196 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3197 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3198 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3199 | .dac_nids = alc880_w810_dac_nids, |
| 3200 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3201 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3202 | .channel_mode = alc880_w810_modes, |
| 3203 | .input_mux = &alc880_capture_source, |
| 3204 | }, |
| 3205 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3206 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3207 | .init_verbs = { alc880_volume_init_verbs, |
| 3208 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3209 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3210 | .dac_nids = alc880_z71v_dac_nids, |
| 3211 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3212 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3213 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3214 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3215 | .input_mux = &alc880_capture_source, |
| 3216 | }, |
| 3217 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3218 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3219 | .init_verbs = { alc880_volume_init_verbs, |
| 3220 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3221 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3222 | .dac_nids = alc880_f1734_dac_nids, |
| 3223 | .hp_nid = 0x02, |
| 3224 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3225 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3226 | .input_mux = &alc880_f1734_capture_source, |
| 3227 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3228 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3229 | }, |
| 3230 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3231 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3232 | .init_verbs = { alc880_volume_init_verbs, |
| 3233 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3234 | alc880_gpio1_init_verbs }, |
| 3235 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3236 | .dac_nids = alc880_asus_dac_nids, |
| 3237 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3238 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3239 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3240 | .input_mux = &alc880_capture_source, |
| 3241 | }, |
| 3242 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3243 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3244 | .init_verbs = { alc880_volume_init_verbs, |
| 3245 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3246 | alc880_gpio1_init_verbs }, |
| 3247 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3248 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3249 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3250 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3251 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3252 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3253 | .input_mux = &alc880_capture_source, |
| 3254 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3255 | [ALC880_ASUS_DIG2] = { |
| 3256 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3257 | .init_verbs = { alc880_volume_init_verbs, |
| 3258 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3259 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3260 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3261 | .dac_nids = alc880_asus_dac_nids, |
| 3262 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3263 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3264 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3265 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3266 | .input_mux = &alc880_capture_source, |
| 3267 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3268 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3269 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3270 | .init_verbs = { alc880_volume_init_verbs, |
| 3271 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3272 | alc880_gpio1_init_verbs }, |
| 3273 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3274 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3275 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3276 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3277 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3278 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3279 | .input_mux = &alc880_capture_source, |
| 3280 | }, |
| 3281 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3282 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3283 | .init_verbs = { alc880_volume_init_verbs, |
| 3284 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3285 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3286 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3287 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3288 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3289 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3290 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3291 | .input_mux = &alc880_capture_source, |
| 3292 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3293 | [ALC880_UNIWILL] = { |
| 3294 | .mixers = { alc880_uniwill_mixer }, |
| 3295 | .init_verbs = { alc880_volume_init_verbs, |
| 3296 | alc880_uniwill_init_verbs }, |
| 3297 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3298 | .dac_nids = alc880_asus_dac_nids, |
| 3299 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3300 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3301 | .channel_mode = alc880_threestack_modes, |
| 3302 | .need_dac_fix = 1, |
| 3303 | .input_mux = &alc880_capture_source, |
| 3304 | .unsol_event = alc880_uniwill_unsol_event, |
| 3305 | .init_hook = alc880_uniwill_automute, |
| 3306 | }, |
| 3307 | [ALC880_UNIWILL_P53] = { |
| 3308 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3309 | .init_verbs = { alc880_volume_init_verbs, |
| 3310 | alc880_uniwill_p53_init_verbs }, |
| 3311 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3312 | .dac_nids = alc880_asus_dac_nids, |
| 3313 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3314 | .channel_mode = alc880_threestack_modes, |
| 3315 | .input_mux = &alc880_capture_source, |
| 3316 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3317 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3318 | }, |
| 3319 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3320 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3321 | alc880_pcbeep_mixer, }, |
| 3322 | .init_verbs = { alc880_volume_init_verbs, |
| 3323 | alc880_uniwill_p53_init_verbs, |
| 3324 | alc880_beep_init_verbs }, |
| 3325 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3326 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3327 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3328 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3329 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3330 | .input_mux = &alc880_capture_source, |
| 3331 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3332 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3333 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3334 | [ALC880_CLEVO] = { |
| 3335 | .mixers = { alc880_three_stack_mixer }, |
| 3336 | .init_verbs = { alc880_volume_init_verbs, |
| 3337 | alc880_pin_clevo_init_verbs }, |
| 3338 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3339 | .dac_nids = alc880_dac_nids, |
| 3340 | .hp_nid = 0x03, |
| 3341 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3342 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3343 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3344 | .input_mux = &alc880_capture_source, |
| 3345 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3346 | [ALC880_LG] = { |
| 3347 | .mixers = { alc880_lg_mixer }, |
| 3348 | .init_verbs = { alc880_volume_init_verbs, |
| 3349 | alc880_lg_init_verbs }, |
| 3350 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3351 | .dac_nids = alc880_lg_dac_nids, |
| 3352 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3353 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3354 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3355 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3356 | .input_mux = &alc880_lg_capture_source, |
| 3357 | .unsol_event = alc880_lg_unsol_event, |
| 3358 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3359 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3360 | .loopbacks = alc880_lg_loopbacks, |
| 3361 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3362 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3363 | [ALC880_LG_LW] = { |
| 3364 | .mixers = { alc880_lg_lw_mixer }, |
| 3365 | .init_verbs = { alc880_volume_init_verbs, |
| 3366 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3367 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3368 | .dac_nids = alc880_dac_nids, |
| 3369 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3370 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3371 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3372 | .input_mux = &alc880_lg_lw_capture_source, |
| 3373 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3374 | .init_hook = alc880_lg_lw_automute, |
| 3375 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3376 | [ALC880_MEDION_RIM] = { |
| 3377 | .mixers = { alc880_medion_rim_mixer }, |
| 3378 | .init_verbs = { alc880_volume_init_verbs, |
| 3379 | alc880_medion_rim_init_verbs, |
| 3380 | alc_gpio2_init_verbs }, |
| 3381 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3382 | .dac_nids = alc880_dac_nids, |
| 3383 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3384 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3385 | .channel_mode = alc880_2_jack_modes, |
| 3386 | .input_mux = &alc880_medion_rim_capture_source, |
| 3387 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3388 | .init_hook = alc880_medion_rim_automute, |
| 3389 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3390 | #ifdef CONFIG_SND_DEBUG |
| 3391 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3392 | .mixers = { alc880_test_mixer }, |
| 3393 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3394 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3395 | .dac_nids = alc880_test_dac_nids, |
| 3396 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3397 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3398 | .channel_mode = alc880_test_modes, |
| 3399 | .input_mux = &alc880_test_capture_source, |
| 3400 | }, |
| 3401 | #endif |
| 3402 | }; |
| 3403 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3404 | /* |
| 3405 | * Automatic parse of I/O pins from the BIOS configuration |
| 3406 | */ |
| 3407 | |
| 3408 | #define NUM_CONTROL_ALLOC 32 |
| 3409 | #define NUM_VERB_ALLOC 32 |
| 3410 | |
| 3411 | enum { |
| 3412 | ALC_CTL_WIDGET_VOL, |
| 3413 | ALC_CTL_WIDGET_MUTE, |
| 3414 | ALC_CTL_BIND_MUTE, |
| 3415 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3416 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3417 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3418 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3419 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3420 | }; |
| 3421 | |
| 3422 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3423 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3424 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3425 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3426 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3427 | |
| 3428 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3429 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3430 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3431 | /* array + terminator */ |
| 3432 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3433 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3434 | return -ENOMEM; |
| 3435 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3436 | memcpy(knew, spec->kctl_alloc, |
| 3437 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3438 | kfree(spec->kctl_alloc); |
| 3439 | } |
| 3440 | spec->kctl_alloc = knew; |
| 3441 | spec->num_kctl_alloc = num; |
| 3442 | } |
| 3443 | |
| 3444 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3445 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3446 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3447 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3448 | return -ENOMEM; |
| 3449 | knew->private_value = val; |
| 3450 | spec->num_kctl_used++; |
| 3451 | return 0; |
| 3452 | } |
| 3453 | |
| 3454 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3455 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3456 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3457 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3458 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3459 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3460 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3461 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3462 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3463 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3464 | #define ALC880_PIN_CD_NID 0x1c |
| 3465 | |
| 3466 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3467 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3468 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3469 | { |
| 3470 | hda_nid_t nid; |
| 3471 | int assigned[4]; |
| 3472 | int i, j; |
| 3473 | |
| 3474 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3475 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3476 | |
| 3477 | /* check the pins hardwired to audio widget */ |
| 3478 | for (i = 0; i < cfg->line_outs; i++) { |
| 3479 | nid = cfg->line_out_pins[i]; |
| 3480 | if (alc880_is_fixed_pin(nid)) { |
| 3481 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3482 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3483 | assigned[idx] = 1; |
| 3484 | } |
| 3485 | } |
| 3486 | /* left pins can be connect to any audio widget */ |
| 3487 | for (i = 0; i < cfg->line_outs; i++) { |
| 3488 | nid = cfg->line_out_pins[i]; |
| 3489 | if (alc880_is_fixed_pin(nid)) |
| 3490 | continue; |
| 3491 | /* search for an empty channel */ |
| 3492 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3493 | if (!assigned[j]) { |
| 3494 | spec->multiout.dac_nids[i] = |
| 3495 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3496 | assigned[j] = 1; |
| 3497 | break; |
| 3498 | } |
| 3499 | } |
| 3500 | } |
| 3501 | spec->multiout.num_dacs = cfg->line_outs; |
| 3502 | return 0; |
| 3503 | } |
| 3504 | |
| 3505 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3506 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3507 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3508 | { |
| 3509 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3510 | static const char *chname[4] = { |
| 3511 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3512 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3513 | hda_nid_t nid; |
| 3514 | int i, err; |
| 3515 | |
| 3516 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3517 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3518 | continue; |
| 3519 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3520 | if (i == 2) { |
| 3521 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3522 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3523 | "Center Playback Volume", |
| 3524 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3525 | HDA_OUTPUT)); |
| 3526 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3527 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3528 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3529 | "LFE Playback Volume", |
| 3530 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3531 | HDA_OUTPUT)); |
| 3532 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3533 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3534 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3535 | "Center Playback Switch", |
| 3536 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3537 | HDA_INPUT)); |
| 3538 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3539 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3540 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3541 | "LFE Playback Switch", |
| 3542 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3543 | HDA_INPUT)); |
| 3544 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3545 | return err; |
| 3546 | } else { |
| 3547 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3548 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3549 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3550 | HDA_OUTPUT)); |
| 3551 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3552 | return err; |
| 3553 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3554 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3555 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3556 | HDA_INPUT)); |
| 3557 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3558 | return err; |
| 3559 | } |
| 3560 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3561 | return 0; |
| 3562 | } |
| 3563 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3564 | /* add playback controls for speaker and HP outputs */ |
| 3565 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3566 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3567 | { |
| 3568 | hda_nid_t nid; |
| 3569 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3570 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3571 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3572 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3573 | return 0; |
| 3574 | |
| 3575 | if (alc880_is_fixed_pin(pin)) { |
| 3576 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3577 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3578 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3579 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3580 | else |
| 3581 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3582 | /* control HP volume/switch on the output mixer amp */ |
| 3583 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3584 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3585 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3586 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3587 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3588 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3589 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3590 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3591 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3592 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3593 | return err; |
| 3594 | } else if (alc880_is_multi_pin(pin)) { |
| 3595 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3596 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3597 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3598 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3599 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3600 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3601 | return err; |
| 3602 | } |
| 3603 | return 0; |
| 3604 | } |
| 3605 | |
| 3606 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3607 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3608 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3609 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3610 | { |
| 3611 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3612 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3613 | |
| 3614 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3615 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3616 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3617 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3618 | return err; |
| 3619 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3620 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3621 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3622 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3623 | return err; |
| 3624 | return 0; |
| 3625 | } |
| 3626 | |
| 3627 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3628 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3629 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3630 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3631 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3632 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3633 | |
| 3634 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3635 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3636 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3637 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3638 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3639 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3640 | if (err < 0) |
| 3641 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3642 | imux->items[imux->num_items].label = |
| 3643 | auto_pin_cfg_labels[i]; |
| 3644 | imux->items[imux->num_items].index = |
| 3645 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3646 | imux->num_items++; |
| 3647 | } |
| 3648 | } |
| 3649 | return 0; |
| 3650 | } |
| 3651 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3652 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3653 | unsigned int pin_type) |
| 3654 | { |
| 3655 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3656 | pin_type); |
| 3657 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3658 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3659 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3660 | } |
| 3661 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3662 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3663 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3664 | int dac_idx) |
| 3665 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3666 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3667 | /* need the manual connection? */ |
| 3668 | if (alc880_is_multi_pin(nid)) { |
| 3669 | struct alc_spec *spec = codec->spec; |
| 3670 | int idx = alc880_multi_pin_idx(nid); |
| 3671 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3672 | AC_VERB_SET_CONNECT_SEL, |
| 3673 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3674 | } |
| 3675 | } |
| 3676 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3677 | static int get_pin_type(int line_out_type) |
| 3678 | { |
| 3679 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3680 | return PIN_HP; |
| 3681 | else |
| 3682 | return PIN_OUT; |
| 3683 | } |
| 3684 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3685 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3686 | { |
| 3687 | struct alc_spec *spec = codec->spec; |
| 3688 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3689 | |
| 3690 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3691 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3692 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3693 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3694 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3695 | } |
| 3696 | } |
| 3697 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3698 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3699 | { |
| 3700 | struct alc_spec *spec = codec->spec; |
| 3701 | hda_nid_t pin; |
| 3702 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3703 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3704 | if (pin) /* connect to front */ |
| 3705 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3706 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3707 | if (pin) /* connect to front */ |
| 3708 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3709 | } |
| 3710 | |
| 3711 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3712 | { |
| 3713 | struct alc_spec *spec = codec->spec; |
| 3714 | int i; |
| 3715 | |
| 3716 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3717 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3718 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3719 | snd_hda_codec_write(codec, nid, 0, |
| 3720 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3721 | i <= AUTO_PIN_FRONT_MIC ? |
| 3722 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3723 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3724 | snd_hda_codec_write(codec, nid, 0, |
| 3725 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3726 | AMP_OUT_MUTE); |
| 3727 | } |
| 3728 | } |
| 3729 | } |
| 3730 | |
| 3731 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3732 | /* return 1 if successful, 0 if the proper config is not found, |
| 3733 | * or a negative error code |
| 3734 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3735 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3736 | { |
| 3737 | struct alc_spec *spec = codec->spec; |
| 3738 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3739 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3740 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3741 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3742 | alc880_ignore); |
| 3743 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3744 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3745 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3746 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3747 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3748 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3749 | if (err < 0) |
| 3750 | return err; |
| 3751 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3752 | if (err < 0) |
| 3753 | return err; |
| 3754 | err = alc880_auto_create_extra_out(spec, |
| 3755 | spec->autocfg.speaker_pins[0], |
| 3756 | "Speaker"); |
| 3757 | if (err < 0) |
| 3758 | return err; |
| 3759 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3760 | "Headphone"); |
| 3761 | if (err < 0) |
| 3762 | return err; |
| 3763 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3764 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3765 | return err; |
| 3766 | |
| 3767 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3768 | |
| 3769 | if (spec->autocfg.dig_out_pin) |
| 3770 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3771 | if (spec->autocfg.dig_in_pin) |
| 3772 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3773 | |
| 3774 | if (spec->kctl_alloc) |
| 3775 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3776 | |
| 3777 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3778 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3779 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3780 | spec->input_mux = &spec->private_imux; |
| 3781 | |
| 3782 | return 1; |
| 3783 | } |
| 3784 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3785 | /* additional initialization for auto-configuration model */ |
| 3786 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3787 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3788 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3789 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3790 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3791 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3792 | if (spec->unsol_event) |
| 3793 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3794 | } |
| 3795 | |
| 3796 | /* |
| 3797 | * OK, here we have finally the patch for ALC880 |
| 3798 | */ |
| 3799 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3800 | static int patch_alc880(struct hda_codec *codec) |
| 3801 | { |
| 3802 | struct alc_spec *spec; |
| 3803 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3804 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3805 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3806 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3807 | if (spec == NULL) |
| 3808 | return -ENOMEM; |
| 3809 | |
| 3810 | codec->spec = spec; |
| 3811 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3812 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3813 | alc880_models, |
| 3814 | alc880_cfg_tbl); |
| 3815 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3816 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3817 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3818 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3819 | } |
| 3820 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3821 | if (board_config == ALC880_AUTO) { |
| 3822 | /* automatic parse from the BIOS config */ |
| 3823 | err = alc880_parse_auto_config(codec); |
| 3824 | if (err < 0) { |
| 3825 | alc_free(codec); |
| 3826 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3827 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3828 | printk(KERN_INFO |
| 3829 | "hda_codec: Cannot set up configuration " |
| 3830 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3831 | board_config = ALC880_3ST; |
| 3832 | } |
| 3833 | } |
| 3834 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3835 | if (board_config != ALC880_AUTO) |
| 3836 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3837 | |
| 3838 | spec->stream_name_analog = "ALC880 Analog"; |
| 3839 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3840 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3841 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3842 | |
| 3843 | spec->stream_name_digital = "ALC880 Digital"; |
| 3844 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3845 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3846 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3847 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3848 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3849 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3850 | /* get type */ |
| 3851 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3852 | if (wcap != AC_WID_AUD_IN) { |
| 3853 | spec->adc_nids = alc880_adc_nids_alt; |
| 3854 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3855 | spec->mixers[spec->num_mixers] = |
| 3856 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3857 | spec->num_mixers++; |
| 3858 | } else { |
| 3859 | spec->adc_nids = alc880_adc_nids; |
| 3860 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3861 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3862 | spec->num_mixers++; |
| 3863 | } |
| 3864 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3865 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3866 | spec->vmaster_nid = 0x0c; |
| 3867 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3868 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3869 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3870 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3871 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3872 | if (!spec->loopback.amplist) |
| 3873 | spec->loopback.amplist = alc880_loopbacks; |
| 3874 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3875 | |
| 3876 | return 0; |
| 3877 | } |
| 3878 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3879 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3880 | /* |
| 3881 | * ALC260 support |
| 3882 | */ |
| 3883 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3884 | static hda_nid_t alc260_dac_nids[1] = { |
| 3885 | /* front */ |
| 3886 | 0x02, |
| 3887 | }; |
| 3888 | |
| 3889 | static hda_nid_t alc260_adc_nids[1] = { |
| 3890 | /* ADC0 */ |
| 3891 | 0x04, |
| 3892 | }; |
| 3893 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3894 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3895 | /* ADC1 */ |
| 3896 | 0x05, |
| 3897 | }; |
| 3898 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3899 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3900 | /* ADC1, 0 */ |
| 3901 | 0x05, 0x04 |
| 3902 | }; |
| 3903 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3904 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3905 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3906 | */ |
| 3907 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3908 | /* ADC0, ADC1 */ |
| 3909 | 0x04, 0x05 |
| 3910 | }; |
| 3911 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3912 | #define ALC260_DIGOUT_NID 0x03 |
| 3913 | #define ALC260_DIGIN_NID 0x06 |
| 3914 | |
| 3915 | static struct hda_input_mux alc260_capture_source = { |
| 3916 | .num_items = 4, |
| 3917 | .items = { |
| 3918 | { "Mic", 0x0 }, |
| 3919 | { "Front Mic", 0x1 }, |
| 3920 | { "Line", 0x2 }, |
| 3921 | { "CD", 0x4 }, |
| 3922 | }, |
| 3923 | }; |
| 3924 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3925 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3926 | * headphone jack and the internal CD lines since these are the only pins at |
| 3927 | * which audio can appear. For flexibility, also allow the option of |
| 3928 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3929 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3930 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3931 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3932 | { |
| 3933 | .num_items = 3, |
| 3934 | .items = { |
| 3935 | { "Mic/Line", 0x0 }, |
| 3936 | { "CD", 0x4 }, |
| 3937 | { "Headphone", 0x2 }, |
| 3938 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3939 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3940 | { |
| 3941 | .num_items = 4, |
| 3942 | .items = { |
| 3943 | { "Mic/Line", 0x0 }, |
| 3944 | { "CD", 0x4 }, |
| 3945 | { "Headphone", 0x2 }, |
| 3946 | { "Mixer", 0x5 }, |
| 3947 | }, |
| 3948 | }, |
| 3949 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3950 | }; |
| 3951 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3952 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3953 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3954 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3955 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3956 | { |
| 3957 | .num_items = 4, |
| 3958 | .items = { |
| 3959 | { "Mic", 0x0 }, |
| 3960 | { "Line", 0x2 }, |
| 3961 | { "CD", 0x4 }, |
| 3962 | { "Headphone", 0x5 }, |
| 3963 | }, |
| 3964 | }, |
| 3965 | { |
| 3966 | .num_items = 5, |
| 3967 | .items = { |
| 3968 | { "Mic", 0x0 }, |
| 3969 | { "Line", 0x2 }, |
| 3970 | { "CD", 0x4 }, |
| 3971 | { "Headphone", 0x6 }, |
| 3972 | { "Mixer", 0x5 }, |
| 3973 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3974 | }, |
| 3975 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3976 | /* |
| 3977 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3978 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3979 | * element which allows changing the channel mode, so the verb list is |
| 3980 | * never used. |
| 3981 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3982 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3983 | { 2, NULL }, |
| 3984 | }; |
| 3985 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3986 | |
| 3987 | /* Mixer combinations |
| 3988 | * |
| 3989 | * basic: base_output + input + pc_beep + capture |
| 3990 | * HP: base_output + input + capture_alt |
| 3991 | * HP_3013: hp_3013 + input + capture |
| 3992 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3993 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3994 | */ |
| 3995 | |
| 3996 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3997 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3998 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3999 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4000 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4001 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4002 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4003 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4004 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4005 | |
| 4006 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4007 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4008 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4009 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4010 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4011 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4012 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4013 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4014 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4015 | { } /* end */ |
| 4016 | }; |
| 4017 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4018 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 4019 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4020 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4021 | { } /* end */ |
| 4022 | }; |
| 4023 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4024 | /* update HP, line and mono out pins according to the master switch */ |
| 4025 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4026 | hda_nid_t hp, hda_nid_t line, |
| 4027 | hda_nid_t mono) |
| 4028 | { |
| 4029 | struct alc_spec *spec = codec->spec; |
| 4030 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4031 | /* change HP and line-out pins */ |
| 4032 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4033 | val); |
| 4034 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4035 | val); |
| 4036 | /* mono (speaker) depending on the HP jack sense */ |
| 4037 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 4038 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4039 | val); |
| 4040 | } |
| 4041 | |
| 4042 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4043 | struct snd_ctl_elem_value *ucontrol) |
| 4044 | { |
| 4045 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4046 | struct alc_spec *spec = codec->spec; |
| 4047 | *ucontrol->value.integer.value = spec->master_sw; |
| 4048 | return 0; |
| 4049 | } |
| 4050 | |
| 4051 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4052 | struct snd_ctl_elem_value *ucontrol) |
| 4053 | { |
| 4054 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4055 | struct alc_spec *spec = codec->spec; |
| 4056 | int val = !!*ucontrol->value.integer.value; |
| 4057 | hda_nid_t hp, line, mono; |
| 4058 | |
| 4059 | if (val == spec->master_sw) |
| 4060 | return 0; |
| 4061 | spec->master_sw = val; |
| 4062 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4063 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4064 | mono = kcontrol->private_value & 0xff; |
| 4065 | alc260_hp_master_update(codec, hp, line, mono); |
| 4066 | return 1; |
| 4067 | } |
| 4068 | |
| 4069 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4070 | { |
| 4071 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4072 | .name = "Master Playback Switch", |
| 4073 | .info = snd_ctl_boolean_mono_info, |
| 4074 | .get = alc260_hp_master_sw_get, |
| 4075 | .put = alc260_hp_master_sw_put, |
| 4076 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4077 | }, |
| 4078 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4079 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4080 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4081 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4082 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4083 | HDA_OUTPUT), |
| 4084 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4085 | { } /* end */ |
| 4086 | }; |
| 4087 | |
| 4088 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4089 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4090 | {}, |
| 4091 | }; |
| 4092 | |
| 4093 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4094 | { |
| 4095 | struct alc_spec *spec = codec->spec; |
| 4096 | unsigned int present; |
| 4097 | |
| 4098 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4099 | AC_VERB_GET_PIN_SENSE, 0); |
| 4100 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4101 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4102 | } |
| 4103 | |
| 4104 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4105 | { |
| 4106 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4107 | alc260_hp_automute(codec); |
| 4108 | } |
| 4109 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4110 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4111 | { |
| 4112 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4113 | .name = "Master Playback Switch", |
| 4114 | .info = snd_ctl_boolean_mono_info, |
| 4115 | .get = alc260_hp_master_sw_get, |
| 4116 | .put = alc260_hp_master_sw_put, |
| 4117 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 4118 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4119 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4120 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4121 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4122 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4123 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4124 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4125 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4126 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4127 | { } /* end */ |
| 4128 | }; |
| 4129 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4130 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4131 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4132 | {}, |
| 4133 | }; |
| 4134 | |
| 4135 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4136 | { |
| 4137 | struct alc_spec *spec = codec->spec; |
| 4138 | unsigned int present; |
| 4139 | |
| 4140 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4141 | AC_VERB_GET_PIN_SENSE, 0); |
| 4142 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4143 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 4144 | } |
| 4145 | |
| 4146 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4147 | unsigned int res) |
| 4148 | { |
| 4149 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4150 | alc260_hp_3013_automute(codec); |
| 4151 | } |
| 4152 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4153 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 4154 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4155 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4156 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4157 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4158 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4159 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4160 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4161 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4162 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4163 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4164 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4165 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4166 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4167 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4168 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4169 | { } /* end */ |
| 4170 | }; |
| 4171 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4172 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4173 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4174 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4175 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4176 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4177 | * revisions available in early 2006. Therefore for now allow the |
| 4178 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4179 | * that the lack of mic bias for this NID is intentional we could change the |
| 4180 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4181 | * |
| 4182 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4183 | * don't appear to make the mic bias available from the "line" jack, even |
| 4184 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4185 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4186 | * and the output jack. If this turns out to be the case for all such |
| 4187 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4188 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4189 | * |
| 4190 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4191 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4192 | * controls for such models. On models without a "mono speaker" the control |
| 4193 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4194 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4195 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4196 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4197 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4198 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4199 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4200 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4201 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4202 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4203 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4204 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4205 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4206 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4207 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4208 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4209 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4210 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4211 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4212 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4213 | { } /* end */ |
| 4214 | }; |
| 4215 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4216 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4217 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4218 | */ |
| 4219 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4220 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4221 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4222 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4223 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4224 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4225 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4226 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4227 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4228 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4229 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4230 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4231 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4232 | { } /* end */ |
| 4233 | }; |
| 4234 | |
| 4235 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4236 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4237 | */ |
| 4238 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4239 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4240 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4241 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4242 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4243 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4244 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4245 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4246 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4247 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4248 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4249 | { } /* end */ |
| 4250 | }; |
| 4251 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4252 | /* capture mixer elements */ |
| 4253 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4254 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4255 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4256 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4257 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4258 | { |
| 4259 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4260 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4261 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4262 | */ |
| 4263 | /* .name = "Capture Source", */ |
| 4264 | .name = "Input Source", |
| 4265 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4266 | .info = alc_mux_enum_info, |
| 4267 | .get = alc_mux_enum_get, |
| 4268 | .put = alc_mux_enum_put, |
| 4269 | }, |
| 4270 | { } /* end */ |
| 4271 | }; |
| 4272 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4273 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4274 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4275 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4276 | { |
| 4277 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4278 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4279 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4280 | */ |
| 4281 | /* .name = "Capture Source", */ |
| 4282 | .name = "Input Source", |
| 4283 | .count = 1, |
| 4284 | .info = alc_mux_enum_info, |
| 4285 | .get = alc_mux_enum_get, |
| 4286 | .put = alc_mux_enum_put, |
| 4287 | }, |
| 4288 | { } /* end */ |
| 4289 | }; |
| 4290 | |
| 4291 | /* |
| 4292 | * initialization verbs |
| 4293 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4294 | static struct hda_verb alc260_init_verbs[] = { |
| 4295 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4296 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4297 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4298 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4299 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4300 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4301 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4302 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4303 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4304 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4305 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4306 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4307 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4308 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4309 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4310 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4311 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4312 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4313 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4314 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4315 | /* set connection select to line in (default select for this ADC) */ |
| 4316 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4317 | /* mute capture amp left and right */ |
| 4318 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4319 | /* set connection select to line in (default select for this ADC) */ |
| 4320 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4321 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4322 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4323 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4324 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4325 | /* set vol=0 HP mixer amp left and right */ |
| 4326 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4327 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4328 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4329 | /* set vol=0 Mono mixer amp left and right */ |
| 4330 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4331 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4332 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4333 | /* unmute LINE-2 out pin */ |
| 4334 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4335 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4336 | * Line In 2 = 0x03 |
| 4337 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4338 | /* mute analog inputs */ |
| 4339 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4340 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4341 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4342 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4343 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4344 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4345 | /* mute Front out path */ |
| 4346 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4347 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4348 | /* mute Headphone out path */ |
| 4349 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4350 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4351 | /* mute Mono out path */ |
| 4352 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4353 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4354 | { } |
| 4355 | }; |
| 4356 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4357 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4358 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4359 | /* Headphone and output */ |
| 4360 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4361 | /* mono output */ |
| 4362 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4363 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4364 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4365 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4366 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4367 | /* Line In pin widget for input */ |
| 4368 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4369 | /* Line-2 pin widget for output */ |
| 4370 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4371 | /* CD pin widget for input */ |
| 4372 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4373 | /* unmute amp left and right */ |
| 4374 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4375 | /* set connection select to line in (default select for this ADC) */ |
| 4376 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4377 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4378 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4379 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4380 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4381 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4382 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4383 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4384 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4385 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4386 | * Line In 2 = 0x03 |
| 4387 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4388 | /* mute analog inputs */ |
| 4389 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4390 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4391 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4392 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4393 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4394 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4395 | /* Unmute Front out path */ |
| 4396 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4397 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4398 | /* Unmute Headphone out path */ |
| 4399 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4400 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4401 | /* Unmute Mono out path */ |
| 4402 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4403 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4404 | { } |
| 4405 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4406 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4407 | |
| 4408 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4409 | /* Line out and output */ |
| 4410 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4411 | /* mono output */ |
| 4412 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4413 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4414 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4415 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4416 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4417 | /* Line In pin widget for input */ |
| 4418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4419 | /* Headphone pin widget for output */ |
| 4420 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4421 | /* CD pin widget for input */ |
| 4422 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4423 | /* unmute amp left and right */ |
| 4424 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4425 | /* set connection select to line in (default select for this ADC) */ |
| 4426 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4427 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4428 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4429 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4430 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4431 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4432 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4433 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4434 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4435 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4436 | * Line In 2 = 0x03 |
| 4437 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4438 | /* mute analog inputs */ |
| 4439 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4440 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4441 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4442 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4443 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4444 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4445 | /* Unmute Front out path */ |
| 4446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4447 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4448 | /* Unmute Headphone out path */ |
| 4449 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4450 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4451 | /* Unmute Mono out path */ |
| 4452 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4453 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4454 | { } |
| 4455 | }; |
| 4456 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4457 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4458 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4459 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4460 | */ |
| 4461 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4462 | /* Disable all GPIOs */ |
| 4463 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4464 | /* Internal speaker is connected to headphone pin */ |
| 4465 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4466 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4467 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4468 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4469 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4470 | /* Ensure all other unused pins are disabled and muted. */ |
| 4471 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4472 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4473 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4474 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4475 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4476 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4477 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4478 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4479 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4480 | /* Disable digital (SPDIF) pins */ |
| 4481 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4482 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4483 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4484 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4485 | * when acting as an output. |
| 4486 | */ |
| 4487 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4488 | |
| 4489 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4490 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4491 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4492 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4493 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4494 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4495 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4496 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4497 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4498 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4499 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4500 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4501 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4502 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4503 | * If the pin mode is changed by the user the pin mode control will |
| 4504 | * take care of enabling the pin's input/output buffers as needed. |
| 4505 | * Therefore there's no need to enable the input buffer at this |
| 4506 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4507 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4509 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4510 | * mixer ctrl) |
| 4511 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4512 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4513 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4514 | /* Mute capture amp left and right */ |
| 4515 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4516 | /* Set ADC connection select to match default mixer setting - line |
| 4517 | * in (on mic1 pin) |
| 4518 | */ |
| 4519 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4520 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4521 | /* Do the same for the second ADC: mute capture input amp and |
| 4522 | * set ADC connection to line in (on mic1 pin) |
| 4523 | */ |
| 4524 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4525 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4526 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4527 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4528 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4529 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4530 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4531 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4532 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4533 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4534 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4535 | {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] | 4536 | |
| 4537 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4538 | }; |
| 4539 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4540 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4541 | * similar laptops (adapted from Fujitsu init verbs). |
| 4542 | */ |
| 4543 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4544 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4545 | * the headphone jack. Turn this on and rely on the standard mute |
| 4546 | * methods whenever the user wants to turn these outputs off. |
| 4547 | */ |
| 4548 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4549 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4550 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4551 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4552 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4553 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4554 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4555 | /* Line In jack is connected to Line1 pin */ |
| 4556 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4557 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4558 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4559 | /* Ensure all other unused pins are disabled and muted. */ |
| 4560 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4561 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4562 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4563 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4564 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4565 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4566 | /* Disable digital (SPDIF) pins */ |
| 4567 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4568 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4569 | |
| 4570 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4571 | * bus when acting as outputs. |
| 4572 | */ |
| 4573 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4574 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4575 | |
| 4576 | /* Start with output sum widgets muted and their output gains at min */ |
| 4577 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4578 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4579 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4580 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4581 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4582 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4583 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4584 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4585 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4586 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4587 | /* Unmute Line-out pin widget amp left and right |
| 4588 | * (no equiv mixer ctrl) |
| 4589 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4590 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4591 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4592 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4593 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4594 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4595 | * will take care of enabling the pin's input/output buffers as needed. |
| 4596 | * Therefore there's no need to enable the input buffer at this |
| 4597 | * stage. |
| 4598 | */ |
| 4599 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4600 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4601 | |
| 4602 | /* Mute capture amp left and right */ |
| 4603 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4604 | /* Set ADC connection select to match default mixer setting - mic |
| 4605 | * (on mic1 pin) |
| 4606 | */ |
| 4607 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4608 | |
| 4609 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4610 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4611 | */ |
| 4612 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4613 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4614 | |
| 4615 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4616 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4617 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4618 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4619 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4620 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4621 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4622 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4623 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4624 | |
| 4625 | { } |
| 4626 | }; |
| 4627 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4628 | static struct hda_verb alc260_will_verbs[] = { |
| 4629 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4630 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4631 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4632 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4633 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4634 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4635 | {} |
| 4636 | }; |
| 4637 | |
| 4638 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4639 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4640 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4641 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4642 | |
| 4643 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4644 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4645 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4646 | |
| 4647 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4648 | {} |
| 4649 | }; |
| 4650 | |
| 4651 | /* toggle speaker-output according to the hp-jack state */ |
| 4652 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4653 | { |
| 4654 | unsigned int present; |
| 4655 | |
| 4656 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4657 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4658 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4659 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4660 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4661 | AC_VERB_SET_GPIO_DATA, 1); |
| 4662 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4663 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4664 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4665 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4666 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4667 | AC_VERB_SET_GPIO_DATA, 0); |
| 4668 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4669 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4670 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4671 | } |
| 4672 | } |
| 4673 | |
| 4674 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4675 | unsigned int res) |
| 4676 | { |
| 4677 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4678 | alc260_replacer_672v_automute(codec); |
| 4679 | } |
| 4680 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4681 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4682 | * configuration. |
| 4683 | */ |
| 4684 | #ifdef CONFIG_SND_DEBUG |
| 4685 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4686 | 0x02, |
| 4687 | }; |
| 4688 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4689 | 0x04, 0x05, |
| 4690 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4691 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4692 | * the signal assignments are different. This assumes that the first ADC |
| 4693 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4694 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4695 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4696 | { |
| 4697 | .num_items = 7, |
| 4698 | .items = { |
| 4699 | { "MIC1 pin", 0x0 }, |
| 4700 | { "MIC2 pin", 0x1 }, |
| 4701 | { "LINE1 pin", 0x2 }, |
| 4702 | { "LINE2 pin", 0x3 }, |
| 4703 | { "CD pin", 0x4 }, |
| 4704 | { "LINE-OUT pin", 0x5 }, |
| 4705 | { "HP-OUT pin", 0x6 }, |
| 4706 | }, |
| 4707 | }, |
| 4708 | { |
| 4709 | .num_items = 8, |
| 4710 | .items = { |
| 4711 | { "MIC1 pin", 0x0 }, |
| 4712 | { "MIC2 pin", 0x1 }, |
| 4713 | { "LINE1 pin", 0x2 }, |
| 4714 | { "LINE2 pin", 0x3 }, |
| 4715 | { "CD pin", 0x4 }, |
| 4716 | { "Mixer", 0x5 }, |
| 4717 | { "LINE-OUT pin", 0x6 }, |
| 4718 | { "HP-OUT pin", 0x7 }, |
| 4719 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4720 | }, |
| 4721 | }; |
| 4722 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4723 | /* Output driver widgets */ |
| 4724 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4725 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4726 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4727 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4728 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4729 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4730 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4731 | /* Modes for retasking pin widgets |
| 4732 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4733 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4734 | * mention this restriction. At this stage it's not clear whether |
| 4735 | * this behaviour is intentional or is a hardware bug in chip |
| 4736 | * revisions available at least up until early 2006. Therefore for |
| 4737 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4738 | * choices, but if it turns out that the lack of mic bias for these |
| 4739 | * NIDs is intentional we could change their modes from |
| 4740 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4741 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4742 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4743 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4744 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4745 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4746 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4747 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4748 | |
| 4749 | /* Loopback mixer controls */ |
| 4750 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4751 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4752 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4753 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4754 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4755 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4756 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4757 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4758 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4759 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4760 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4761 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4762 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4763 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4764 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4765 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4766 | |
| 4767 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4768 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4769 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4770 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4771 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4772 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4773 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4774 | * is ambigious as to which NID is which; testing on laptops which |
| 4775 | * make this output available should provide clarification. |
| 4776 | */ |
| 4777 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4778 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4779 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4780 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4781 | * this output to turn on an external amplifier. |
| 4782 | */ |
| 4783 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4784 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4785 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4786 | { } /* end */ |
| 4787 | }; |
| 4788 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4789 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4790 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4791 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4792 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4793 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4794 | /* Enable retasking pins as output, initially without power amp */ |
| 4795 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4796 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4797 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4798 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4799 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4800 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4801 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4802 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4803 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4804 | * payload also sets the generation to 0, output to be in "consumer" |
| 4805 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4806 | * control. |
| 4807 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4808 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4809 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4810 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4811 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4812 | * OUT1 sum bus when acting as an output. |
| 4813 | */ |
| 4814 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4815 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4816 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4817 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4818 | |
| 4819 | /* Start with output sum widgets muted and their output gains at min */ |
| 4820 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4821 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4822 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4823 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4824 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4825 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4826 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4827 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4828 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4829 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4830 | /* Unmute retasking pin widget output buffers since the default |
| 4831 | * state appears to be output. As the pin mode is changed by the |
| 4832 | * user the pin mode control will take care of enabling the pin's |
| 4833 | * input/output buffers as needed. |
| 4834 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4835 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4836 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4837 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4838 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4839 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4840 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4841 | /* Also unmute the mono-out pin widget */ |
| 4842 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4843 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4844 | /* Mute capture amp left and right */ |
| 4845 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4846 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4847 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4848 | */ |
| 4849 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4850 | |
| 4851 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4852 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4853 | */ |
| 4854 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4855 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4856 | |
| 4857 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4858 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4859 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4860 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4861 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4862 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4863 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4864 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4865 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4866 | |
| 4867 | { } |
| 4868 | }; |
| 4869 | #endif |
| 4870 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4871 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4872 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4873 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4874 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4875 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4876 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4877 | /* |
| 4878 | * for BIOS auto-configuration |
| 4879 | */ |
| 4880 | |
| 4881 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4882 | const char *pfx) |
| 4883 | { |
| 4884 | hda_nid_t nid_vol; |
| 4885 | unsigned long vol_val, sw_val; |
| 4886 | char name[32]; |
| 4887 | int err; |
| 4888 | |
| 4889 | if (nid >= 0x0f && nid < 0x11) { |
| 4890 | nid_vol = nid - 0x7; |
| 4891 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4892 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4893 | } else if (nid == 0x11) { |
| 4894 | nid_vol = nid - 0x7; |
| 4895 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4896 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4897 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4898 | nid_vol = 0x08; |
| 4899 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4900 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4901 | } else |
| 4902 | return 0; /* N/A */ |
| 4903 | |
| 4904 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4905 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4906 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4907 | return err; |
| 4908 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4909 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4910 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4911 | return err; |
| 4912 | return 1; |
| 4913 | } |
| 4914 | |
| 4915 | /* add playback controls from the parsed DAC table */ |
| 4916 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4917 | const struct auto_pin_cfg *cfg) |
| 4918 | { |
| 4919 | hda_nid_t nid; |
| 4920 | int err; |
| 4921 | |
| 4922 | spec->multiout.num_dacs = 1; |
| 4923 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4924 | spec->multiout.dac_nids[0] = 0x02; |
| 4925 | |
| 4926 | nid = cfg->line_out_pins[0]; |
| 4927 | if (nid) { |
| 4928 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4929 | if (err < 0) |
| 4930 | return err; |
| 4931 | } |
| 4932 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4933 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4934 | if (nid) { |
| 4935 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4936 | if (err < 0) |
| 4937 | return err; |
| 4938 | } |
| 4939 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4940 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4941 | if (nid) { |
| 4942 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4943 | if (err < 0) |
| 4944 | return err; |
| 4945 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4946 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4947 | } |
| 4948 | |
| 4949 | /* create playback/capture controls for input pins */ |
| 4950 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4951 | const struct auto_pin_cfg *cfg) |
| 4952 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4953 | struct hda_input_mux *imux = &spec->private_imux; |
| 4954 | int i, err, idx; |
| 4955 | |
| 4956 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4957 | if (cfg->input_pins[i] >= 0x12) { |
| 4958 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4959 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4960 | auto_pin_cfg_labels[i], idx, |
| 4961 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4962 | if (err < 0) |
| 4963 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4964 | imux->items[imux->num_items].label = |
| 4965 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4966 | imux->items[imux->num_items].index = idx; |
| 4967 | imux->num_items++; |
| 4968 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4969 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4970 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4971 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4972 | auto_pin_cfg_labels[i], idx, |
| 4973 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4974 | if (err < 0) |
| 4975 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4976 | imux->items[imux->num_items].label = |
| 4977 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4978 | imux->items[imux->num_items].index = idx; |
| 4979 | imux->num_items++; |
| 4980 | } |
| 4981 | } |
| 4982 | return 0; |
| 4983 | } |
| 4984 | |
| 4985 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4986 | hda_nid_t nid, int pin_type, |
| 4987 | int sel_idx) |
| 4988 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4989 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4990 | /* need the manual connection? */ |
| 4991 | if (nid >= 0x12) { |
| 4992 | int idx = nid - 0x12; |
| 4993 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4994 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4995 | } |
| 4996 | } |
| 4997 | |
| 4998 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4999 | { |
| 5000 | struct alc_spec *spec = codec->spec; |
| 5001 | hda_nid_t nid; |
| 5002 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5003 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5004 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5005 | if (nid) { |
| 5006 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5007 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5008 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5009 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5010 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5011 | if (nid) |
| 5012 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5013 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5014 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5015 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5016 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5017 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5018 | |
| 5019 | #define ALC260_PIN_CD_NID 0x16 |
| 5020 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5021 | { |
| 5022 | struct alc_spec *spec = codec->spec; |
| 5023 | int i; |
| 5024 | |
| 5025 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5026 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5027 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5028 | snd_hda_codec_write(codec, nid, 0, |
| 5029 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5030 | i <= AUTO_PIN_FRONT_MIC ? |
| 5031 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5032 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5033 | snd_hda_codec_write(codec, nid, 0, |
| 5034 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5035 | AMP_OUT_MUTE); |
| 5036 | } |
| 5037 | } |
| 5038 | } |
| 5039 | |
| 5040 | /* |
| 5041 | * generic initialization of ADC, input mixers and output mixers |
| 5042 | */ |
| 5043 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5044 | /* |
| 5045 | * Unmute ADC0-1 and set the default input to mic-in |
| 5046 | */ |
| 5047 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5048 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5049 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5050 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5051 | |
| 5052 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5053 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5054 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5055 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5056 | */ |
| 5057 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5058 | /* mute analog inputs */ |
| 5059 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5060 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5061 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5062 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5063 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5064 | |
| 5065 | /* |
| 5066 | * Set up output mixers (0x08 - 0x0a) |
| 5067 | */ |
| 5068 | /* set vol=0 to output mixers */ |
| 5069 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5070 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5071 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5072 | /* set up input amps for analog loopback */ |
| 5073 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5074 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5075 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5076 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5077 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5078 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5079 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5080 | |
| 5081 | { } |
| 5082 | }; |
| 5083 | |
| 5084 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5085 | { |
| 5086 | struct alc_spec *spec = codec->spec; |
| 5087 | unsigned int wcap; |
| 5088 | int err; |
| 5089 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5090 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5091 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5092 | alc260_ignore); |
| 5093 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5094 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5095 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5096 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5097 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5098 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5099 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5100 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5101 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5102 | return err; |
| 5103 | |
| 5104 | spec->multiout.max_channels = 2; |
| 5105 | |
| 5106 | if (spec->autocfg.dig_out_pin) |
| 5107 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 5108 | if (spec->kctl_alloc) |
| 5109 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 5110 | |
| 5111 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 5112 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5113 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5114 | spec->input_mux = &spec->private_imux; |
| 5115 | |
| 5116 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5117 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5118 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 5119 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5120 | spec->adc_nids = alc260_adc_nids_alt; |
| 5121 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5122 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5123 | } else { |
| 5124 | spec->adc_nids = alc260_adc_nids; |
| 5125 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5126 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5127 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5128 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5129 | |
| 5130 | return 1; |
| 5131 | } |
| 5132 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5133 | /* additional initialization for auto-configuration model */ |
| 5134 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5135 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5136 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5137 | alc260_auto_init_multi_out(codec); |
| 5138 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5139 | if (spec->unsol_event) |
| 5140 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5141 | } |
| 5142 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5143 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5144 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5145 | { 0x07, HDA_INPUT, 0 }, |
| 5146 | { 0x07, HDA_INPUT, 1 }, |
| 5147 | { 0x07, HDA_INPUT, 2 }, |
| 5148 | { 0x07, HDA_INPUT, 3 }, |
| 5149 | { 0x07, HDA_INPUT, 4 }, |
| 5150 | { } /* end */ |
| 5151 | }; |
| 5152 | #endif |
| 5153 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5154 | /* |
| 5155 | * ALC260 configurations |
| 5156 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5157 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5158 | [ALC260_BASIC] = "basic", |
| 5159 | [ALC260_HP] = "hp", |
| 5160 | [ALC260_HP_3013] = "hp-3013", |
| 5161 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5162 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5163 | [ALC260_WILL] = "will", |
| 5164 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5165 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5166 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5167 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5168 | [ALC260_AUTO] = "auto", |
| 5169 | }; |
| 5170 | |
| 5171 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5172 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5173 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5174 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5175 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5176 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5177 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5178 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 5179 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5180 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5181 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5182 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5183 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5184 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5185 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5186 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5187 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5188 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5189 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5190 | {} |
| 5191 | }; |
| 5192 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5193 | static struct alc_config_preset alc260_presets[] = { |
| 5194 | [ALC260_BASIC] = { |
| 5195 | .mixers = { alc260_base_output_mixer, |
| 5196 | alc260_input_mixer, |
| 5197 | alc260_pc_beep_mixer, |
| 5198 | alc260_capture_mixer }, |
| 5199 | .init_verbs = { alc260_init_verbs }, |
| 5200 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5201 | .dac_nids = alc260_dac_nids, |
| 5202 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5203 | .adc_nids = alc260_adc_nids, |
| 5204 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5205 | .channel_mode = alc260_modes, |
| 5206 | .input_mux = &alc260_capture_source, |
| 5207 | }, |
| 5208 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5209 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5210 | alc260_input_mixer, |
| 5211 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5212 | .init_verbs = { alc260_init_verbs, |
| 5213 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5214 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5215 | .dac_nids = alc260_dac_nids, |
| 5216 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5217 | .adc_nids = alc260_hp_adc_nids, |
| 5218 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5219 | .channel_mode = alc260_modes, |
| 5220 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5221 | .unsol_event = alc260_hp_unsol_event, |
| 5222 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5223 | }, |
| 5224 | [ALC260_HP_3013] = { |
| 5225 | .mixers = { alc260_hp_3013_mixer, |
| 5226 | alc260_input_mixer, |
| 5227 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5228 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5229 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5230 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5231 | .dac_nids = alc260_dac_nids, |
| 5232 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5233 | .adc_nids = alc260_hp_adc_nids, |
| 5234 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5235 | .channel_mode = alc260_modes, |
| 5236 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5237 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5238 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5239 | }, |
| 5240 | [ALC260_FUJITSU_S702X] = { |
| 5241 | .mixers = { alc260_fujitsu_mixer, |
| 5242 | alc260_capture_mixer }, |
| 5243 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5244 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5245 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5246 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5247 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5248 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5249 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5250 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5251 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5252 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5253 | [ALC260_ACER] = { |
| 5254 | .mixers = { alc260_acer_mixer, |
| 5255 | alc260_capture_mixer }, |
| 5256 | .init_verbs = { alc260_acer_init_verbs }, |
| 5257 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5258 | .dac_nids = alc260_dac_nids, |
| 5259 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5260 | .adc_nids = alc260_dual_adc_nids, |
| 5261 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5262 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5263 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5264 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5265 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5266 | [ALC260_WILL] = { |
| 5267 | .mixers = { alc260_will_mixer, |
| 5268 | alc260_capture_mixer }, |
| 5269 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5270 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5271 | .dac_nids = alc260_dac_nids, |
| 5272 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5273 | .adc_nids = alc260_adc_nids, |
| 5274 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5275 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5276 | .channel_mode = alc260_modes, |
| 5277 | .input_mux = &alc260_capture_source, |
| 5278 | }, |
| 5279 | [ALC260_REPLACER_672V] = { |
| 5280 | .mixers = { alc260_replacer_672v_mixer, |
| 5281 | alc260_capture_mixer }, |
| 5282 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5283 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5284 | .dac_nids = alc260_dac_nids, |
| 5285 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5286 | .adc_nids = alc260_adc_nids, |
| 5287 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5288 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5289 | .channel_mode = alc260_modes, |
| 5290 | .input_mux = &alc260_capture_source, |
| 5291 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5292 | .init_hook = alc260_replacer_672v_automute, |
| 5293 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5294 | #ifdef CONFIG_SND_DEBUG |
| 5295 | [ALC260_TEST] = { |
| 5296 | .mixers = { alc260_test_mixer, |
| 5297 | alc260_capture_mixer }, |
| 5298 | .init_verbs = { alc260_test_init_verbs }, |
| 5299 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5300 | .dac_nids = alc260_test_dac_nids, |
| 5301 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5302 | .adc_nids = alc260_test_adc_nids, |
| 5303 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5304 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5305 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5306 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5307 | }, |
| 5308 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5309 | }; |
| 5310 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5311 | static int patch_alc260(struct hda_codec *codec) |
| 5312 | { |
| 5313 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5314 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5315 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5316 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5317 | if (spec == NULL) |
| 5318 | return -ENOMEM; |
| 5319 | |
| 5320 | codec->spec = spec; |
| 5321 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5322 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5323 | alc260_models, |
| 5324 | alc260_cfg_tbl); |
| 5325 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5326 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5327 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5328 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5329 | } |
| 5330 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5331 | if (board_config == ALC260_AUTO) { |
| 5332 | /* automatic parse from the BIOS config */ |
| 5333 | err = alc260_parse_auto_config(codec); |
| 5334 | if (err < 0) { |
| 5335 | alc_free(codec); |
| 5336 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5337 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5338 | printk(KERN_INFO |
| 5339 | "hda_codec: Cannot set up configuration " |
| 5340 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5341 | board_config = ALC260_BASIC; |
| 5342 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5343 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5344 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5345 | if (board_config != ALC260_AUTO) |
| 5346 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5347 | |
| 5348 | spec->stream_name_analog = "ALC260 Analog"; |
| 5349 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5350 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5351 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5352 | spec->stream_name_digital = "ALC260 Digital"; |
| 5353 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5354 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5355 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5356 | spec->vmaster_nid = 0x08; |
| 5357 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5358 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5359 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5360 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5361 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5362 | if (!spec->loopback.amplist) |
| 5363 | spec->loopback.amplist = alc260_loopbacks; |
| 5364 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5365 | |
| 5366 | return 0; |
| 5367 | } |
| 5368 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5369 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5370 | /* |
| 5371 | * ALC882 support |
| 5372 | * |
| 5373 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5374 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5375 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5376 | * 6-channel independent captures. |
| 5377 | * |
| 5378 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5379 | * driver yet). |
| 5380 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5381 | #define ALC882_DIGOUT_NID 0x06 |
| 5382 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5383 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5384 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5385 | { 8, NULL } |
| 5386 | }; |
| 5387 | |
| 5388 | static hda_nid_t alc882_dac_nids[4] = { |
| 5389 | /* front, rear, clfe, rear_surr */ |
| 5390 | 0x02, 0x03, 0x04, 0x05 |
| 5391 | }; |
| 5392 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5393 | /* identical with ALC880 */ |
| 5394 | #define alc882_adc_nids alc880_adc_nids |
| 5395 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5396 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5397 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5398 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5399 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5400 | /* input MUX */ |
| 5401 | /* FIXME: should be a matrix-type input source selection */ |
| 5402 | |
| 5403 | static struct hda_input_mux alc882_capture_source = { |
| 5404 | .num_items = 4, |
| 5405 | .items = { |
| 5406 | { "Mic", 0x0 }, |
| 5407 | { "Front Mic", 0x1 }, |
| 5408 | { "Line", 0x2 }, |
| 5409 | { "CD", 0x4 }, |
| 5410 | }, |
| 5411 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5412 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5413 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5414 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5415 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5416 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5417 | { |
| 5418 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5419 | struct alc_spec *spec = codec->spec; |
| 5420 | const struct hda_input_mux *imux = spec->input_mux; |
| 5421 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5422 | hda_nid_t nid = spec->capsrc_nids ? |
| 5423 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5424 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5425 | unsigned int i, idx; |
| 5426 | |
| 5427 | idx = ucontrol->value.enumerated.item[0]; |
| 5428 | if (idx >= imux->num_items) |
| 5429 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5430 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5431 | return 0; |
| 5432 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5433 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5434 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5435 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5436 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5437 | } |
| 5438 | *cur_val = idx; |
| 5439 | return 1; |
| 5440 | } |
| 5441 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5442 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5443 | * 2ch mode |
| 5444 | */ |
| 5445 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5446 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5447 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5448 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5449 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5450 | { } /* end */ |
| 5451 | }; |
| 5452 | |
| 5453 | /* |
| 5454 | * 6ch mode |
| 5455 | */ |
| 5456 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5457 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5458 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5459 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5460 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5461 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5462 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5463 | { } /* end */ |
| 5464 | }; |
| 5465 | |
| 5466 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5467 | { 2, alc882_3ST_ch2_init }, |
| 5468 | { 6, alc882_3ST_ch6_init }, |
| 5469 | }; |
| 5470 | |
| 5471 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5472 | * 6ch mode |
| 5473 | */ |
| 5474 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5475 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5476 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5477 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5478 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5479 | { } /* end */ |
| 5480 | }; |
| 5481 | |
| 5482 | /* |
| 5483 | * 8ch mode |
| 5484 | */ |
| 5485 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5486 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5487 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5488 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5489 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5490 | { } /* end */ |
| 5491 | }; |
| 5492 | |
| 5493 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5494 | { 6, alc882_sixstack_ch6_init }, |
| 5495 | { 8, alc882_sixstack_ch8_init }, |
| 5496 | }; |
| 5497 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5498 | /* |
| 5499 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5500 | */ |
| 5501 | |
| 5502 | /* |
| 5503 | * 2ch mode |
| 5504 | */ |
| 5505 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5506 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5507 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5508 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5509 | { } /* end */ |
| 5510 | }; |
| 5511 | |
| 5512 | /* |
| 5513 | * 6ch mode |
| 5514 | */ |
| 5515 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5516 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5517 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5518 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5519 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5520 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5521 | { } /* end */ |
| 5522 | }; |
| 5523 | |
| 5524 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5525 | { 2, alc885_mbp_ch2_init }, |
| 5526 | { 6, alc885_mbp_ch6_init }, |
| 5527 | }; |
| 5528 | |
| 5529 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5530 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5531 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5532 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5533 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5534 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5535 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5536 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5537 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5538 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5539 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5540 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5541 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5542 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5543 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5544 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5545 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5546 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5547 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5548 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5549 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5550 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5552 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5553 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5554 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5555 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5556 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5557 | { } /* end */ |
| 5558 | }; |
| 5559 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5560 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5561 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5562 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5563 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5564 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5565 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5566 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5567 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5568 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5569 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5570 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5571 | { } /* end */ |
| 5572 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5573 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5574 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5575 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5576 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5577 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5578 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5579 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5580 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5581 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5582 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5583 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5584 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5585 | { } /* end */ |
| 5586 | }; |
| 5587 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5588 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5589 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5590 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5591 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5592 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5593 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5594 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5595 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5596 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5597 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5598 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5599 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5600 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5601 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5602 | { } /* end */ |
| 5603 | }; |
| 5604 | |
| 5605 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5606 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5607 | */ |
| 5608 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5609 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5610 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5611 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5612 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5613 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5614 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5615 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5616 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5617 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5618 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5619 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5620 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5621 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5622 | { } /* end */ |
| 5623 | }; |
| 5624 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5625 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5626 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5627 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5628 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5629 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5630 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5631 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5632 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5633 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5634 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5635 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5636 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5637 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5638 | { } /* end */ |
| 5639 | }; |
| 5640 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5641 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5642 | { |
| 5643 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5644 | .name = "Channel Mode", |
| 5645 | .info = alc_ch_mode_info, |
| 5646 | .get = alc_ch_mode_get, |
| 5647 | .put = alc_ch_mode_put, |
| 5648 | }, |
| 5649 | { } /* end */ |
| 5650 | }; |
| 5651 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5652 | static struct hda_verb alc882_init_verbs[] = { |
| 5653 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5654 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5655 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5656 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5657 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5658 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5659 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5660 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5661 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5662 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5663 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5664 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5665 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5666 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5667 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5668 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5669 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5670 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5671 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5672 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5673 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5674 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5675 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5676 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5677 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5678 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5679 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5680 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5681 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5682 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5683 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5684 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5685 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5686 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5687 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5688 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5689 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5690 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5691 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5692 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5693 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5694 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5695 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5696 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5697 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5698 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5699 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5700 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5701 | |
| 5702 | /* FIXME: use matrix-type input source selection */ |
| 5703 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5704 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5705 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5706 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5707 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5708 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5709 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5710 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5711 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5712 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5713 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5714 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5715 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5716 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5717 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5718 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5719 | /* ADC1: mute amp left and right */ |
| 5720 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5721 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5722 | /* ADC2: mute amp left and right */ |
| 5723 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5724 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5725 | /* ADC3: mute amp left and right */ |
| 5726 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5727 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5728 | |
| 5729 | { } |
| 5730 | }; |
| 5731 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5732 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5733 | /* change to EAPD mode */ |
| 5734 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5735 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5736 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5737 | }; |
| 5738 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5739 | /* Mac Pro test */ |
| 5740 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5741 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5742 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5743 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5744 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5745 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5746 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5747 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5748 | { } /* end */ |
| 5749 | }; |
| 5750 | |
| 5751 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5752 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5753 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5754 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5755 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5756 | /* Front Pin: output 0 (0x0c) */ |
| 5757 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5758 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5759 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5760 | /* Front Mic pin: input vref at 80% */ |
| 5761 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5762 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5763 | /* Speaker: output */ |
| 5764 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5765 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5766 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5767 | /* Headphone output (output 0 - 0x0c) */ |
| 5768 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5769 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5770 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 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, AMP_IN_UNMUTE(0)}, |
| 5776 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5777 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5778 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5779 | /* Input mixer2 */ |
| 5780 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5781 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5782 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5783 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5784 | /* Input mixer3 */ |
| 5785 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5786 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5787 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5788 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5789 | /* ADC1: mute amp left and right */ |
| 5790 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5791 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5792 | /* ADC2: mute amp left and right */ |
| 5793 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5794 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5795 | /* ADC3: mute amp left and right */ |
| 5796 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5797 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5798 | |
| 5799 | { } |
| 5800 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5801 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5802 | /* Macbook Pro rev3 */ |
| 5803 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5804 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5805 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5806 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5807 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5808 | /* Rear mixer */ |
| 5809 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5810 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5811 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5812 | /* Front Pin: output 0 (0x0c) */ |
| 5813 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5814 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5815 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5816 | /* HP Pin: output 0 (0x0d) */ |
| 5817 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5818 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5819 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5820 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5821 | /* Mic (rear) pin: input vref at 80% */ |
| 5822 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5823 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5824 | /* Front Mic pin: input vref at 80% */ |
| 5825 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5826 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5827 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5828 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5829 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5830 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5831 | |
| 5832 | /* FIXME: use matrix-type input source selection */ |
| 5833 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5834 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5835 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5836 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5837 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5838 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5839 | /* Input mixer2 */ |
| 5840 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5841 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5842 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5843 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5844 | /* Input mixer3 */ |
| 5845 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5846 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5847 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5848 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5849 | /* ADC1: mute amp left and right */ |
| 5850 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5851 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5852 | /* ADC2: mute amp left and right */ |
| 5853 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5854 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5855 | /* ADC3: mute amp left and right */ |
| 5856 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5857 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5858 | |
| 5859 | { } |
| 5860 | }; |
| 5861 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5862 | /* iMac 24 mixer. */ |
| 5863 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5864 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5865 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5866 | { } /* end */ |
| 5867 | }; |
| 5868 | |
| 5869 | /* iMac 24 init verbs. */ |
| 5870 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5871 | /* Internal speakers: output 0 (0x0c) */ |
| 5872 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5873 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5874 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5875 | /* Internal speakers: output 0 (0x0c) */ |
| 5876 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5877 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5878 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5879 | /* Headphone: output 0 (0x0c) */ |
| 5880 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5881 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5882 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5883 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5884 | /* Front Mic: input vref at 80% */ |
| 5885 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5886 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5887 | { } |
| 5888 | }; |
| 5889 | |
| 5890 | /* Toggle speaker-output according to the hp-jack state */ |
| 5891 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5892 | { |
| 5893 | unsigned int present; |
| 5894 | |
| 5895 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5896 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5897 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5898 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5899 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5900 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5901 | } |
| 5902 | |
| 5903 | /* Processes unsolicited events. */ |
| 5904 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5905 | unsigned int res) |
| 5906 | { |
| 5907 | /* Headphone insertion or removal. */ |
| 5908 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5909 | alc885_imac24_automute(codec); |
| 5910 | } |
| 5911 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5912 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5913 | { |
| 5914 | unsigned int present; |
| 5915 | |
| 5916 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5917 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5918 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5919 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5920 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5921 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5922 | |
| 5923 | } |
| 5924 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5925 | unsigned int res) |
| 5926 | { |
| 5927 | /* Headphone insertion or removal. */ |
| 5928 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5929 | alc885_mbp3_automute(codec); |
| 5930 | } |
| 5931 | |
| 5932 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5933 | static struct hda_verb alc882_targa_verbs[] = { |
| 5934 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5935 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5936 | |
| 5937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5938 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5939 | |
| 5940 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5941 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5942 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5943 | |
| 5944 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5945 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5946 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5947 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5948 | { } /* end */ |
| 5949 | }; |
| 5950 | |
| 5951 | /* toggle speaker-output according to the hp-jack state */ |
| 5952 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5953 | { |
| 5954 | unsigned int present; |
| 5955 | |
| 5956 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5957 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5958 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5959 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5960 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5961 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5962 | } |
| 5963 | |
| 5964 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5965 | { |
| 5966 | /* Looks like the unsol event is incompatible with the standard |
| 5967 | * definition. 4bit tag is placed at 26 bit! |
| 5968 | */ |
| 5969 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5970 | alc882_targa_automute(codec); |
| 5971 | } |
| 5972 | } |
| 5973 | |
| 5974 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5975 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5976 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5977 | |
| 5978 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5979 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5980 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5981 | |
| 5982 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5983 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5984 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5985 | |
| 5986 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5987 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5988 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5989 | { } /* end */ |
| 5990 | }; |
| 5991 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5992 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5993 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5994 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5995 | |
| 5996 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5997 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5998 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5999 | |
| 6000 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6001 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6002 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6003 | |
| 6004 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6005 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6006 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6007 | { } /* end */ |
| 6008 | }; |
| 6009 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6010 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6011 | { |
| 6012 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6013 | |
| 6014 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6015 | AC_VERB_GET_GPIO_DATA, 0); |
| 6016 | |
| 6017 | if (!muted) |
| 6018 | gpiostate |= (1 << pin); |
| 6019 | else |
| 6020 | gpiostate &= ~(1 << pin); |
| 6021 | |
| 6022 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6023 | AC_VERB_GET_GPIO_MASK, 0); |
| 6024 | gpiomask |= (1 << pin); |
| 6025 | |
| 6026 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6027 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6028 | gpiodir |= (1 << pin); |
| 6029 | |
| 6030 | |
| 6031 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6032 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6033 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6034 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6035 | |
| 6036 | msleep(1); |
| 6037 | |
| 6038 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6039 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6040 | } |
| 6041 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6042 | /* set up GPIO at initialization */ |
| 6043 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6044 | { |
| 6045 | alc882_gpio_mute(codec, 0, 0); |
| 6046 | alc882_gpio_mute(codec, 1, 0); |
| 6047 | } |
| 6048 | |
| 6049 | /* set up GPIO and update auto-muting at initialization */ |
| 6050 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6051 | { |
| 6052 | alc885_macpro_init_hook(codec); |
| 6053 | alc885_imac24_automute(codec); |
| 6054 | } |
| 6055 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6056 | /* |
| 6057 | * generic initialization of ADC, input mixers and output mixers |
| 6058 | */ |
| 6059 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6060 | /* |
| 6061 | * Unmute ADC0-2 and set the default input to mic-in |
| 6062 | */ |
| 6063 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6064 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6065 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6066 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6067 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6068 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6069 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6070 | /* 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] | 6071 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6072 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6073 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6074 | */ |
| 6075 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6076 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6077 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6078 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6079 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6080 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6081 | |
| 6082 | /* |
| 6083 | * Set up output mixers (0x0c - 0x0f) |
| 6084 | */ |
| 6085 | /* set vol=0 to output mixers */ |
| 6086 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6087 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6088 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6089 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6090 | /* set up input amps for analog loopback */ |
| 6091 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6092 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6093 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6094 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6095 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6096 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6097 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6098 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6099 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6100 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6101 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6102 | |
| 6103 | /* FIXME: use matrix-type input source selection */ |
| 6104 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6105 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6106 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6107 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6108 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6109 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6110 | /* Input mixer2 */ |
| 6111 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6112 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6113 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6114 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6115 | /* Input mixer3 */ |
| 6116 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6117 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6118 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6119 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6120 | |
| 6121 | { } |
| 6122 | }; |
| 6123 | |
| 6124 | /* capture mixer elements */ |
| 6125 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 6126 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6127 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6128 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6129 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6130 | { |
| 6131 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6132 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6133 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6134 | */ |
| 6135 | /* .name = "Capture Source", */ |
| 6136 | .name = "Input Source", |
| 6137 | .count = 2, |
| 6138 | .info = alc882_mux_enum_info, |
| 6139 | .get = alc882_mux_enum_get, |
| 6140 | .put = alc882_mux_enum_put, |
| 6141 | }, |
| 6142 | { } /* end */ |
| 6143 | }; |
| 6144 | |
| 6145 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 6146 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 6147 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 6148 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 6149 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 6150 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 6151 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 6152 | { |
| 6153 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6154 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6155 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6156 | */ |
| 6157 | /* .name = "Capture Source", */ |
| 6158 | .name = "Input Source", |
| 6159 | .count = 3, |
| 6160 | .info = alc882_mux_enum_info, |
| 6161 | .get = alc882_mux_enum_get, |
| 6162 | .put = alc882_mux_enum_put, |
| 6163 | }, |
| 6164 | { } /* end */ |
| 6165 | }; |
| 6166 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6167 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6168 | #define alc882_loopbacks alc880_loopbacks |
| 6169 | #endif |
| 6170 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6171 | /* pcm configuration: identiacal with ALC880 */ |
| 6172 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6173 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6174 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6175 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6176 | |
| 6177 | /* |
| 6178 | * configuration and preset |
| 6179 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6180 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6181 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6182 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6183 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6184 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6185 | [ALC882_TARGA] = "targa", |
| 6186 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6187 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6188 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6189 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6190 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6191 | [ALC882_AUTO] = "auto", |
| 6192 | }; |
| 6193 | |
| 6194 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6195 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6196 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6197 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6198 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6199 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6200 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6201 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6202 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6203 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6204 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6205 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6206 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6207 | {} |
| 6208 | }; |
| 6209 | |
| 6210 | static struct alc_config_preset alc882_presets[] = { |
| 6211 | [ALC882_3ST_DIG] = { |
| 6212 | .mixers = { alc882_base_mixer }, |
| 6213 | .init_verbs = { alc882_init_verbs }, |
| 6214 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6215 | .dac_nids = alc882_dac_nids, |
| 6216 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6217 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6218 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6219 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6220 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6221 | .input_mux = &alc882_capture_source, |
| 6222 | }, |
| 6223 | [ALC882_6ST_DIG] = { |
| 6224 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6225 | .init_verbs = { alc882_init_verbs }, |
| 6226 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6227 | .dac_nids = alc882_dac_nids, |
| 6228 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6229 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6230 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6231 | .channel_mode = alc882_sixstack_modes, |
| 6232 | .input_mux = &alc882_capture_source, |
| 6233 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6234 | [ALC882_ARIMA] = { |
| 6235 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6236 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6237 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6238 | .dac_nids = alc882_dac_nids, |
| 6239 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6240 | .channel_mode = alc882_sixstack_modes, |
| 6241 | .input_mux = &alc882_capture_source, |
| 6242 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6243 | [ALC882_W2JC] = { |
| 6244 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6245 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6246 | alc880_gpio1_init_verbs }, |
| 6247 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6248 | .dac_nids = alc882_dac_nids, |
| 6249 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6250 | .channel_mode = alc880_threestack_modes, |
| 6251 | .need_dac_fix = 1, |
| 6252 | .input_mux = &alc882_capture_source, |
| 6253 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6254 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6255 | [ALC885_MBP3] = { |
| 6256 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6257 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6258 | alc880_gpio1_init_verbs }, |
| 6259 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6260 | .dac_nids = alc882_dac_nids, |
| 6261 | .channel_mode = alc885_mbp_6ch_modes, |
| 6262 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6263 | .input_mux = &alc882_capture_source, |
| 6264 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6265 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6266 | .unsol_event = alc885_mbp3_unsol_event, |
| 6267 | .init_hook = alc885_mbp3_automute, |
| 6268 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6269 | [ALC885_MACPRO] = { |
| 6270 | .mixers = { alc882_macpro_mixer }, |
| 6271 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6272 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6273 | .dac_nids = alc882_dac_nids, |
| 6274 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6275 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6276 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6277 | .channel_mode = alc882_ch_modes, |
| 6278 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6279 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6280 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6281 | [ALC885_IMAC24] = { |
| 6282 | .mixers = { alc885_imac24_mixer }, |
| 6283 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6284 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6285 | .dac_nids = alc882_dac_nids, |
| 6286 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6287 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6288 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6289 | .channel_mode = alc882_ch_modes, |
| 6290 | .input_mux = &alc882_capture_source, |
| 6291 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6292 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6293 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6294 | [ALC882_TARGA] = { |
| 6295 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6296 | alc882_capture_mixer }, |
| 6297 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6298 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6299 | .dac_nids = alc882_dac_nids, |
| 6300 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6301 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6302 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6303 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6304 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6305 | .channel_mode = alc882_3ST_6ch_modes, |
| 6306 | .need_dac_fix = 1, |
| 6307 | .input_mux = &alc882_capture_source, |
| 6308 | .unsol_event = alc882_targa_unsol_event, |
| 6309 | .init_hook = alc882_targa_automute, |
| 6310 | }, |
| 6311 | [ALC882_ASUS_A7J] = { |
| 6312 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6313 | alc882_capture_mixer }, |
| 6314 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6315 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6316 | .dac_nids = alc882_dac_nids, |
| 6317 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6318 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6319 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6320 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6321 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6322 | .channel_mode = alc882_3ST_6ch_modes, |
| 6323 | .need_dac_fix = 1, |
| 6324 | .input_mux = &alc882_capture_source, |
| 6325 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6326 | [ALC882_ASUS_A7M] = { |
| 6327 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6328 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6329 | alc880_gpio1_init_verbs, |
| 6330 | alc882_asus_a7m_verbs }, |
| 6331 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6332 | .dac_nids = alc882_dac_nids, |
| 6333 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6334 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6335 | .channel_mode = alc880_threestack_modes, |
| 6336 | .need_dac_fix = 1, |
| 6337 | .input_mux = &alc882_capture_source, |
| 6338 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6339 | }; |
| 6340 | |
| 6341 | |
| 6342 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6343 | * Pin config fixes |
| 6344 | */ |
| 6345 | enum { |
| 6346 | PINFIX_ABIT_AW9D_MAX |
| 6347 | }; |
| 6348 | |
| 6349 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6350 | { 0x15, 0x01080104 }, /* side */ |
| 6351 | { 0x16, 0x01011012 }, /* rear */ |
| 6352 | { 0x17, 0x01016011 }, /* clfe */ |
| 6353 | { } |
| 6354 | }; |
| 6355 | |
| 6356 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6357 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6358 | }; |
| 6359 | |
| 6360 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6361 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6362 | {} |
| 6363 | }; |
| 6364 | |
| 6365 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6366 | * BIOS auto configuration |
| 6367 | */ |
| 6368 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6369 | hda_nid_t nid, int pin_type, |
| 6370 | int dac_idx) |
| 6371 | { |
| 6372 | /* set as output */ |
| 6373 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6374 | int idx; |
| 6375 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6376 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6377 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6378 | idx = 4; |
| 6379 | else |
| 6380 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6381 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6382 | |
| 6383 | } |
| 6384 | |
| 6385 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6386 | { |
| 6387 | struct alc_spec *spec = codec->spec; |
| 6388 | int i; |
| 6389 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6390 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6391 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6392 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6393 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6394 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6395 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6396 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6397 | } |
| 6398 | } |
| 6399 | |
| 6400 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6401 | { |
| 6402 | struct alc_spec *spec = codec->spec; |
| 6403 | hda_nid_t pin; |
| 6404 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6405 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6406 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6407 | /* use dac 0 */ |
| 6408 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6409 | pin = spec->autocfg.speaker_pins[0]; |
| 6410 | if (pin) |
| 6411 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6412 | } |
| 6413 | |
| 6414 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6415 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6416 | |
| 6417 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6418 | { |
| 6419 | struct alc_spec *spec = codec->spec; |
| 6420 | int i; |
| 6421 | |
| 6422 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6423 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6424 | unsigned int vref; |
| 6425 | if (!nid) |
| 6426 | continue; |
| 6427 | vref = PIN_IN; |
| 6428 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6429 | unsigned int pincap; |
| 6430 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6431 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6432 | AC_PINCAP_VREF_80) |
| 6433 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6434 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6435 | snd_hda_codec_write(codec, nid, 0, |
| 6436 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6437 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6438 | snd_hda_codec_write(codec, nid, 0, |
| 6439 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6440 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6441 | } |
| 6442 | } |
| 6443 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6444 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 6445 | { |
| 6446 | struct alc_spec *spec = codec->spec; |
| 6447 | const struct hda_input_mux *imux = spec->input_mux; |
| 6448 | int c; |
| 6449 | |
| 6450 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 6451 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 6452 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 6453 | int conns, mute, idx, item; |
| 6454 | |
| 6455 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 6456 | ARRAY_SIZE(conn_list)); |
| 6457 | if (conns < 0) |
| 6458 | continue; |
| 6459 | for (idx = 0; idx < conns; idx++) { |
| 6460 | /* if the current connection is the selected one, |
| 6461 | * unmute it as default - otherwise mute it |
| 6462 | */ |
| 6463 | mute = AMP_IN_MUTE(idx); |
| 6464 | for (item = 0; item < imux->num_items; item++) { |
| 6465 | if (imux->items[item].index == idx) { |
| 6466 | if (spec->cur_mux[c] == item) |
| 6467 | mute = AMP_IN_UNMUTE(idx); |
| 6468 | break; |
| 6469 | } |
| 6470 | } |
| 6471 | snd_hda_codec_write(codec, nid, 0, |
| 6472 | AC_VERB_SET_AMP_GAIN_MUTE, mute); |
| 6473 | } |
| 6474 | } |
| 6475 | } |
| 6476 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6477 | /* add mic boosts if needed */ |
| 6478 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6479 | { |
| 6480 | struct alc_spec *spec = codec->spec; |
| 6481 | int err; |
| 6482 | hda_nid_t nid; |
| 6483 | |
| 6484 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6485 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6486 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6487 | "Mic Boost", |
| 6488 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6489 | if (err < 0) |
| 6490 | return err; |
| 6491 | } |
| 6492 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6493 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6494 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6495 | "Front Mic Boost", |
| 6496 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6497 | if (err < 0) |
| 6498 | return err; |
| 6499 | } |
| 6500 | return 0; |
| 6501 | } |
| 6502 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6503 | /* almost identical with ALC880 parser... */ |
| 6504 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6505 | { |
| 6506 | struct alc_spec *spec = codec->spec; |
| 6507 | int err = alc880_parse_auto_config(codec); |
| 6508 | |
| 6509 | if (err < 0) |
| 6510 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6511 | else if (!err) |
| 6512 | return 0; /* no config found */ |
| 6513 | |
| 6514 | err = alc_auto_add_mic_boost(codec); |
| 6515 | if (err < 0) |
| 6516 | return err; |
| 6517 | |
| 6518 | /* hack - override the init verbs */ |
| 6519 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6520 | |
| 6521 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6522 | } |
| 6523 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6524 | /* additional initialization for auto-configuration model */ |
| 6525 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6526 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6527 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6528 | alc882_auto_init_multi_out(codec); |
| 6529 | alc882_auto_init_hp_out(codec); |
| 6530 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6531 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6532 | if (spec->unsol_event) |
| 6533 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6534 | } |
| 6535 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6536 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6537 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6538 | static int patch_alc882(struct hda_codec *codec) |
| 6539 | { |
| 6540 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6541 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6542 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6543 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6544 | if (spec == NULL) |
| 6545 | return -ENOMEM; |
| 6546 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6547 | codec->spec = spec; |
| 6548 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6549 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6550 | alc882_models, |
| 6551 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6552 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6553 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6554 | /* Pick up systems that don't supply PCI SSID */ |
| 6555 | switch (codec->subsystem_id) { |
| 6556 | case 0x106b0c00: /* Mac Pro */ |
| 6557 | board_config = ALC885_MACPRO; |
| 6558 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6559 | case 0x106b1000: /* iMac 24 */ |
| 6560 | board_config = ALC885_IMAC24; |
| 6561 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6562 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6563 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6564 | case 0x106b3600: /* Macbook 3.1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6565 | board_config = ALC885_MBP3; |
| 6566 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6567 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6568 | /* ALC889A is handled better as ALC888-compatible */ |
| 6569 | if (codec->revision_id == 0x100103) { |
| 6570 | alc_free(codec); |
| 6571 | return patch_alc883(codec); |
| 6572 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6573 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6574 | "trying auto-probe from BIOS...\n"); |
| 6575 | board_config = ALC882_AUTO; |
| 6576 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6577 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6578 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6579 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6580 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6581 | if (board_config == ALC882_AUTO) { |
| 6582 | /* automatic parse from the BIOS config */ |
| 6583 | err = alc882_parse_auto_config(codec); |
| 6584 | if (err < 0) { |
| 6585 | alc_free(codec); |
| 6586 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6587 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6588 | printk(KERN_INFO |
| 6589 | "hda_codec: Cannot set up configuration " |
| 6590 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6591 | board_config = ALC882_3ST_DIG; |
| 6592 | } |
| 6593 | } |
| 6594 | |
| 6595 | if (board_config != ALC882_AUTO) |
| 6596 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6597 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 6598 | if (codec->vendor_id == 0x10ec0885) { |
| 6599 | spec->stream_name_analog = "ALC885 Analog"; |
| 6600 | spec->stream_name_digital = "ALC885 Digital"; |
| 6601 | } else { |
| 6602 | spec->stream_name_analog = "ALC882 Analog"; |
| 6603 | spec->stream_name_digital = "ALC882 Digital"; |
| 6604 | } |
| 6605 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6606 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6607 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6608 | /* FIXME: setup DAC5 */ |
| 6609 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6610 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6611 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6612 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6613 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6614 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6615 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6616 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6617 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6618 | /* get type */ |
| 6619 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6620 | if (wcap != AC_WID_AUD_IN) { |
| 6621 | spec->adc_nids = alc882_adc_nids_alt; |
| 6622 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6623 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6624 | spec->mixers[spec->num_mixers] = |
| 6625 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6626 | spec->num_mixers++; |
| 6627 | } else { |
| 6628 | spec->adc_nids = alc882_adc_nids; |
| 6629 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6630 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6631 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6632 | spec->num_mixers++; |
| 6633 | } |
| 6634 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6635 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6636 | spec->vmaster_nid = 0x0c; |
| 6637 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6638 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6639 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6640 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6641 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6642 | if (!spec->loopback.amplist) |
| 6643 | spec->loopback.amplist = alc882_loopbacks; |
| 6644 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6645 | |
| 6646 | return 0; |
| 6647 | } |
| 6648 | |
| 6649 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6650 | * ALC883 support |
| 6651 | * |
| 6652 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6653 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6654 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6655 | * 6-channel independent captures. |
| 6656 | * |
| 6657 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6658 | * driver yet). |
| 6659 | */ |
| 6660 | #define ALC883_DIGOUT_NID 0x06 |
| 6661 | #define ALC883_DIGIN_NID 0x0a |
| 6662 | |
| 6663 | static hda_nid_t alc883_dac_nids[4] = { |
| 6664 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6665 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6666 | }; |
| 6667 | |
| 6668 | static hda_nid_t alc883_adc_nids[2] = { |
| 6669 | /* ADC1-2 */ |
| 6670 | 0x08, 0x09, |
| 6671 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6672 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6673 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6674 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6675 | /* input MUX */ |
| 6676 | /* FIXME: should be a matrix-type input source selection */ |
| 6677 | |
| 6678 | static struct hda_input_mux alc883_capture_source = { |
| 6679 | .num_items = 4, |
| 6680 | .items = { |
| 6681 | { "Mic", 0x0 }, |
| 6682 | { "Front Mic", 0x1 }, |
| 6683 | { "Line", 0x2 }, |
| 6684 | { "CD", 0x4 }, |
| 6685 | }, |
| 6686 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6687 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6688 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6689 | .num_items = 4, |
| 6690 | .items = { |
| 6691 | { "Mic", 0x1 }, |
| 6692 | { "Front Mic", 0x0 }, |
| 6693 | { "Line", 0x2 }, |
| 6694 | { "CD", 0x4 }, |
| 6695 | }, |
| 6696 | }; |
| 6697 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6698 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6699 | .num_items = 2, |
| 6700 | .items = { |
| 6701 | { "Mic", 0x1 }, |
| 6702 | { "Line", 0x2 }, |
| 6703 | }, |
| 6704 | }; |
| 6705 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6706 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6707 | .num_items = 4, |
| 6708 | .items = { |
| 6709 | { "Mic", 0x0 }, |
| 6710 | { "iMic", 0x1 }, |
| 6711 | { "Line", 0x2 }, |
| 6712 | { "CD", 0x4 }, |
| 6713 | }, |
| 6714 | }; |
| 6715 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6716 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6717 | .num_items = 2, |
| 6718 | .items = { |
| 6719 | { "Mic", 0x0 }, |
| 6720 | { "Int Mic", 0x1 }, |
| 6721 | }, |
| 6722 | }; |
| 6723 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6724 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6725 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6726 | /* ALC883 has the ALC882-type input selection */ |
| 6727 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6728 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6729 | /* |
| 6730 | * 2ch mode |
| 6731 | */ |
| 6732 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6733 | { 2, NULL } |
| 6734 | }; |
| 6735 | |
| 6736 | /* |
| 6737 | * 2ch mode |
| 6738 | */ |
| 6739 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6740 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6741 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6742 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6743 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6744 | { } /* end */ |
| 6745 | }; |
| 6746 | |
| 6747 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6748 | * 4ch mode |
| 6749 | */ |
| 6750 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6751 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6752 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6753 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6754 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6755 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6756 | { } /* end */ |
| 6757 | }; |
| 6758 | |
| 6759 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6760 | * 6ch mode |
| 6761 | */ |
| 6762 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6763 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6764 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6765 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6766 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6767 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6768 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6769 | { } /* end */ |
| 6770 | }; |
| 6771 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6772 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6773 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6774 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6775 | { 6, alc883_3ST_ch6_init }, |
| 6776 | }; |
| 6777 | |
| 6778 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6779 | * 2ch mode |
| 6780 | */ |
| 6781 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6782 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6783 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6784 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6785 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6786 | { } /* end */ |
| 6787 | }; |
| 6788 | |
| 6789 | /* |
| 6790 | * 4ch mode |
| 6791 | */ |
| 6792 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6793 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6794 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6795 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6796 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6797 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6798 | { } /* end */ |
| 6799 | }; |
| 6800 | |
| 6801 | /* |
| 6802 | * 6ch mode |
| 6803 | */ |
| 6804 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6805 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6806 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6807 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6808 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6809 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6810 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6811 | { } /* end */ |
| 6812 | }; |
| 6813 | |
| 6814 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6815 | { 2, alc883_3ST_ch2_intel_init }, |
| 6816 | { 4, alc883_3ST_ch4_intel_init }, |
| 6817 | { 6, alc883_3ST_ch6_intel_init }, |
| 6818 | }; |
| 6819 | |
| 6820 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6821 | * 6ch mode |
| 6822 | */ |
| 6823 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6824 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6825 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6826 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6827 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6828 | { } /* end */ |
| 6829 | }; |
| 6830 | |
| 6831 | /* |
| 6832 | * 8ch mode |
| 6833 | */ |
| 6834 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6835 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6836 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6837 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6838 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6839 | { } /* end */ |
| 6840 | }; |
| 6841 | |
| 6842 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6843 | { 6, alc883_sixstack_ch6_init }, |
| 6844 | { 8, alc883_sixstack_ch8_init }, |
| 6845 | }; |
| 6846 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6847 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6848 | /* eanable EAPD on medion laptop */ |
| 6849 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6850 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6851 | { } |
| 6852 | }; |
| 6853 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6854 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6855 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6856 | */ |
| 6857 | |
| 6858 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6859 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6860 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6861 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6862 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6863 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6864 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6865 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6866 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6867 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6868 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6869 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6870 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6871 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6872 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6873 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6874 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6875 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6876 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6877 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6878 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6879 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6880 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6881 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6882 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6883 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6884 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6885 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6886 | { |
| 6887 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6888 | /* .name = "Capture Source", */ |
| 6889 | .name = "Input Source", |
| 6890 | .count = 2, |
| 6891 | .info = alc883_mux_enum_info, |
| 6892 | .get = alc883_mux_enum_get, |
| 6893 | .put = alc883_mux_enum_put, |
| 6894 | }, |
| 6895 | { } /* end */ |
| 6896 | }; |
| 6897 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6898 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6899 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6900 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6901 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6902 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6903 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6904 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6905 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6906 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6907 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6908 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6909 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6910 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6911 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6912 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6913 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6914 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6915 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6916 | { |
| 6917 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6918 | /* .name = "Capture Source", */ |
| 6919 | .name = "Input Source", |
| 6920 | .count = 2, |
| 6921 | .info = alc883_mux_enum_info, |
| 6922 | .get = alc883_mux_enum_get, |
| 6923 | .put = alc883_mux_enum_put, |
| 6924 | }, |
| 6925 | { } /* end */ |
| 6926 | }; |
| 6927 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 6928 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 6929 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6930 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6931 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6932 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6933 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6934 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6935 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6936 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6937 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6938 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6939 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6940 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6941 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6942 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6943 | { |
| 6944 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6945 | /* .name = "Capture Source", */ |
| 6946 | .name = "Input Source", |
| 6947 | .count = 2, |
| 6948 | .info = alc883_mux_enum_info, |
| 6949 | .get = alc883_mux_enum_get, |
| 6950 | .put = alc883_mux_enum_put, |
| 6951 | }, |
| 6952 | { } /* end */ |
| 6953 | }; |
| 6954 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6955 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 6956 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6957 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6958 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6959 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6960 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6961 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6962 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6963 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6964 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6965 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6966 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6967 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6968 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6969 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6970 | { |
| 6971 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6972 | /* .name = "Capture Source", */ |
| 6973 | .name = "Input Source", |
| 6974 | .count = 2, |
| 6975 | .info = alc883_mux_enum_info, |
| 6976 | .get = alc883_mux_enum_get, |
| 6977 | .put = alc883_mux_enum_put, |
| 6978 | }, |
| 6979 | { } /* end */ |
| 6980 | }; |
| 6981 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6982 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6984 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6985 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6986 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6987 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6988 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6989 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6990 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6991 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6992 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6993 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6994 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6995 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6996 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6997 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6998 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6999 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7000 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7001 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7002 | { |
| 7003 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7004 | /* .name = "Capture Source", */ |
| 7005 | .name = "Input Source", |
| 7006 | .count = 2, |
| 7007 | .info = alc883_mux_enum_info, |
| 7008 | .get = alc883_mux_enum_get, |
| 7009 | .put = alc883_mux_enum_put, |
| 7010 | }, |
| 7011 | { } /* end */ |
| 7012 | }; |
| 7013 | |
| 7014 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7015 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7016 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7017 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7018 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7019 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7020 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7021 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7022 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7023 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7024 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7025 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7026 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7027 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7028 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7029 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7030 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7031 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7032 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7033 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7034 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7035 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7036 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7037 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7038 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7039 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7040 | { |
| 7041 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7042 | /* .name = "Capture Source", */ |
| 7043 | .name = "Input Source", |
| 7044 | .count = 2, |
| 7045 | .info = alc883_mux_enum_info, |
| 7046 | .get = alc883_mux_enum_get, |
| 7047 | .put = alc883_mux_enum_put, |
| 7048 | }, |
| 7049 | { } /* end */ |
| 7050 | }; |
| 7051 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7052 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7053 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7054 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7055 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7056 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7057 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7058 | HDA_OUTPUT), |
| 7059 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7060 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7061 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7062 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7063 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7064 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7065 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7066 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7067 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7068 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7069 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7070 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7071 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7072 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7073 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7074 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7075 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7076 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7077 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7078 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7079 | { |
| 7080 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7081 | /* .name = "Capture Source", */ |
| 7082 | .name = "Input Source", |
| 7083 | .count = 2, |
| 7084 | .info = alc883_mux_enum_info, |
| 7085 | .get = alc883_mux_enum_get, |
| 7086 | .put = alc883_mux_enum_put, |
| 7087 | }, |
| 7088 | { } /* end */ |
| 7089 | }; |
| 7090 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7091 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7092 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7093 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7094 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7095 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7096 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7097 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7098 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7099 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7100 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7101 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7102 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7103 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7104 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7105 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7106 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7107 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7108 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7109 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7110 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7111 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7112 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7113 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7114 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7115 | |
| 7116 | { |
| 7117 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7118 | /* .name = "Capture Source", */ |
| 7119 | .name = "Input Source", |
| 7120 | .count = 1, |
| 7121 | .info = alc883_mux_enum_info, |
| 7122 | .get = alc883_mux_enum_get, |
| 7123 | .put = alc883_mux_enum_put, |
| 7124 | }, |
| 7125 | { } /* end */ |
| 7126 | }; |
| 7127 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7128 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7129 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7130 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7131 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7132 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7133 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7134 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7135 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7136 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7137 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7138 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7139 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7140 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7141 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7142 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7143 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7144 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7145 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7146 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7147 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7148 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7149 | { |
| 7150 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7151 | /* .name = "Capture Source", */ |
| 7152 | .name = "Input Source", |
| 7153 | .count = 2, |
| 7154 | .info = alc883_mux_enum_info, |
| 7155 | .get = alc883_mux_enum_get, |
| 7156 | .put = alc883_mux_enum_put, |
| 7157 | }, |
| 7158 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7159 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7160 | |
| 7161 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7162 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7163 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7164 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7165 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7166 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7167 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7168 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7170 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7171 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7172 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7173 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7174 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7175 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7176 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7177 | { |
| 7178 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7179 | /* .name = "Capture Source", */ |
| 7180 | .name = "Input Source", |
| 7181 | .count = 2, |
| 7182 | .info = alc883_mux_enum_info, |
| 7183 | .get = alc883_mux_enum_get, |
| 7184 | .put = alc883_mux_enum_put, |
| 7185 | }, |
| 7186 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7187 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7188 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7189 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7190 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7191 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7192 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7193 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7194 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7195 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7196 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7197 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7198 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7199 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7200 | { |
| 7201 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7202 | /* .name = "Capture Source", */ |
| 7203 | .name = "Input Source", |
| 7204 | .count = 1, |
| 7205 | .info = alc883_mux_enum_info, |
| 7206 | .get = alc883_mux_enum_get, |
| 7207 | .put = alc883_mux_enum_put, |
| 7208 | }, |
| 7209 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7210 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7211 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7212 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7213 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7214 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7215 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7216 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7217 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7218 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7219 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7220 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7221 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7222 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7223 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7224 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7225 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7226 | { |
| 7227 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7228 | /* .name = "Capture Source", */ |
| 7229 | .name = "Input Source", |
| 7230 | .count = 2, |
| 7231 | .info = alc883_mux_enum_info, |
| 7232 | .get = alc883_mux_enum_get, |
| 7233 | .put = alc883_mux_enum_put, |
| 7234 | }, |
| 7235 | { } /* end */ |
| 7236 | }; |
| 7237 | |
| 7238 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7239 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7240 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7241 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7242 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7243 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7244 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7245 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7246 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7247 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7248 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7249 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7250 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7251 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7252 | { |
| 7253 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7254 | /* .name = "Capture Source", */ |
| 7255 | .name = "Input Source", |
| 7256 | .count = 2, |
| 7257 | .info = alc883_mux_enum_info, |
| 7258 | .get = alc883_mux_enum_get, |
| 7259 | .put = alc883_mux_enum_put, |
| 7260 | }, |
| 7261 | { } /* end */ |
| 7262 | }; |
| 7263 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7264 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7265 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7266 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7267 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7268 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7269 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7270 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7271 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7272 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7273 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7274 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7275 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7276 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7277 | { |
| 7278 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7279 | /* .name = "Capture Source", */ |
| 7280 | .name = "Input Source", |
| 7281 | .count = 2, |
| 7282 | .info = alc883_mux_enum_info, |
| 7283 | .get = alc883_mux_enum_get, |
| 7284 | .put = alc883_mux_enum_put, |
| 7285 | }, |
| 7286 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7287 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7288 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7289 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7290 | { |
| 7291 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7292 | .name = "Channel Mode", |
| 7293 | .info = alc_ch_mode_info, |
| 7294 | .get = alc_ch_mode_get, |
| 7295 | .put = alc_ch_mode_put, |
| 7296 | }, |
| 7297 | { } /* end */ |
| 7298 | }; |
| 7299 | |
| 7300 | static struct hda_verb alc883_init_verbs[] = { |
| 7301 | /* ADC1: mute amp left and right */ |
| 7302 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7303 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7304 | /* ADC2: mute amp left and right */ |
| 7305 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7306 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7307 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7310 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7311 | /* Rear mixer */ |
| 7312 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7313 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7314 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7315 | /* CLFE mixer */ |
| 7316 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7317 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7318 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7319 | /* Side mixer */ |
| 7320 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7321 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7322 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7323 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7324 | /* mute analog input loopbacks */ |
| 7325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7326 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7329 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7330 | |
| 7331 | /* Front Pin: output 0 (0x0c) */ |
| 7332 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7333 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7334 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7335 | /* Rear Pin: output 1 (0x0d) */ |
| 7336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7337 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7338 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7339 | /* CLFE Pin: output 2 (0x0e) */ |
| 7340 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7341 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7342 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7343 | /* Side Pin: output 3 (0x0f) */ |
| 7344 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7345 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7346 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7347 | /* Mic (rear) pin: input vref at 80% */ |
| 7348 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7349 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7350 | /* Front Mic pin: input vref at 80% */ |
| 7351 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7352 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7353 | /* Line In pin: input */ |
| 7354 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7355 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7356 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7357 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7358 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7359 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7360 | /* CD pin widget for input */ |
| 7361 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7362 | |
| 7363 | /* FIXME: use matrix-type input source selection */ |
| 7364 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7365 | /* Input mixer2 */ |
| 7366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7367 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7368 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7369 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7370 | /* Input mixer3 */ |
| 7371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7372 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7373 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7374 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7375 | { } |
| 7376 | }; |
| 7377 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7378 | /* toggle speaker-output according to the hp-jack state */ |
| 7379 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7380 | { |
| 7381 | unsigned int present; |
| 7382 | |
| 7383 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7384 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7385 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7386 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7387 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7388 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7389 | } |
| 7390 | |
| 7391 | /* auto-toggle front mic */ |
| 7392 | /* |
| 7393 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7394 | { |
| 7395 | unsigned int present; |
| 7396 | unsigned char bits; |
| 7397 | |
| 7398 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7399 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7400 | bits = present ? HDA_AMP_MUTE : 0; |
| 7401 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7402 | } |
| 7403 | */ |
| 7404 | |
| 7405 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7406 | { |
| 7407 | alc883_mitac_hp_automute(codec); |
| 7408 | /* alc883_mitac_mic_automute(codec); */ |
| 7409 | } |
| 7410 | |
| 7411 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7412 | unsigned int res) |
| 7413 | { |
| 7414 | switch (res >> 26) { |
| 7415 | case ALC880_HP_EVENT: |
| 7416 | alc883_mitac_hp_automute(codec); |
| 7417 | break; |
| 7418 | case ALC880_MIC_EVENT: |
| 7419 | /* alc883_mitac_mic_automute(codec); */ |
| 7420 | break; |
| 7421 | } |
| 7422 | } |
| 7423 | |
| 7424 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7425 | /* HP */ |
| 7426 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7427 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7428 | /* Subwoofer */ |
| 7429 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7430 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7431 | |
| 7432 | /* enable unsolicited event */ |
| 7433 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7434 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7435 | |
| 7436 | { } /* end */ |
| 7437 | }; |
| 7438 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7439 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7440 | /* HP */ |
| 7441 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7442 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7443 | /* Int speaker */ |
| 7444 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7445 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7446 | |
| 7447 | /* enable unsolicited event */ |
| 7448 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7449 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7450 | |
| 7451 | { } /* end */ |
| 7452 | }; |
| 7453 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7454 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7455 | /* HP */ |
| 7456 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7457 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7458 | /* Subwoofer */ |
| 7459 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7460 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7461 | |
| 7462 | /* enable unsolicited event */ |
| 7463 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7464 | |
| 7465 | { } /* end */ |
| 7466 | }; |
| 7467 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7468 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7469 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7470 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7471 | |
| 7472 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7473 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7474 | |
| 7475 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7476 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7477 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7478 | |
| 7479 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7480 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7481 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7482 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7483 | |
| 7484 | { } /* end */ |
| 7485 | }; |
| 7486 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7487 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7488 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7489 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7490 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7491 | { } /* end */ |
| 7492 | }; |
| 7493 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7494 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7495 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7496 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7497 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7498 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7499 | { } /* end */ |
| 7500 | }; |
| 7501 | |
| 7502 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7503 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7505 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7506 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7507 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7508 | { } /* end */ |
| 7509 | }; |
| 7510 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7511 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7512 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7513 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7514 | |
| 7515 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7516 | |
| 7517 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7518 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7519 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7520 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7521 | { } /* end */ |
| 7522 | }; |
| 7523 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7524 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7525 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7526 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7527 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7528 | { } |
| 7529 | }; |
| 7530 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7531 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7532 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7533 | { } |
| 7534 | }; |
| 7535 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7536 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7537 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7538 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7539 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7540 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7541 | { } |
| 7542 | }; |
| 7543 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7544 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7545 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7546 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7547 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7548 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7549 | { } |
| 7550 | }; |
| 7551 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7552 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7553 | { 2, alc888_3st_hp_2ch_init }, |
| 7554 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7555 | }; |
| 7556 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7557 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7558 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7559 | { |
| 7560 | unsigned int present; |
| 7561 | |
| 7562 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7563 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7564 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7565 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7566 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7567 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7568 | } |
| 7569 | |
| 7570 | /* toggle RCA according to the front-jack state */ |
| 7571 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7572 | { |
| 7573 | unsigned int present; |
| 7574 | |
| 7575 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7576 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7577 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7578 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7579 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7580 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7581 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7582 | unsigned int res) |
| 7583 | { |
| 7584 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7585 | alc888_lenovo_ms7195_front_automute(codec); |
| 7586 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7587 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7588 | } |
| 7589 | |
| 7590 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7593 | |
| 7594 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7595 | |
| 7596 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7597 | { } /* end */ |
| 7598 | }; |
| 7599 | |
| 7600 | /* toggle speaker-output according to the hp-jack state */ |
| 7601 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7602 | { |
| 7603 | unsigned int present; |
| 7604 | |
| 7605 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7606 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7607 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7608 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7609 | } |
| 7610 | |
| 7611 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7612 | unsigned int res) |
| 7613 | { |
| 7614 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7615 | alc883_medion_md2_automute(codec); |
| 7616 | } |
| 7617 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7618 | /* toggle speaker-output according to the hp-jack state */ |
| 7619 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7620 | { |
| 7621 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7622 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7623 | |
| 7624 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7625 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7626 | bits = present ? HDA_AMP_MUTE : 0; |
| 7627 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7628 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7629 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7630 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7631 | } |
| 7632 | |
| 7633 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7634 | { |
| 7635 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7636 | alc883_tagra_automute(codec); |
| 7637 | } |
| 7638 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7639 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7640 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7641 | { |
| 7642 | unsigned int present; |
| 7643 | unsigned char bits; |
| 7644 | |
| 7645 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7646 | & AC_PINSENSE_PRESENCE; |
| 7647 | bits = present ? HDA_AMP_MUTE : 0; |
| 7648 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7649 | HDA_AMP_MUTE, bits); |
| 7650 | } |
| 7651 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7652 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7653 | { |
| 7654 | unsigned int present; |
| 7655 | |
| 7656 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7657 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7658 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7659 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7660 | } |
| 7661 | |
| 7662 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7663 | { |
| 7664 | alc883_clevo_m720_hp_automute(codec); |
| 7665 | alc883_clevo_m720_mic_automute(codec); |
| 7666 | } |
| 7667 | |
| 7668 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7669 | unsigned int res) |
| 7670 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7671 | switch (res >> 26) { |
| 7672 | case ALC880_HP_EVENT: |
| 7673 | alc883_clevo_m720_hp_automute(codec); |
| 7674 | break; |
| 7675 | case ALC880_MIC_EVENT: |
| 7676 | alc883_clevo_m720_mic_automute(codec); |
| 7677 | break; |
| 7678 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7679 | } |
| 7680 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7681 | /* toggle speaker-output according to the hp-jack state */ |
| 7682 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7683 | { |
| 7684 | unsigned int present; |
| 7685 | unsigned char bits; |
| 7686 | |
| 7687 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7688 | & AC_PINSENSE_PRESENCE; |
| 7689 | bits = present ? HDA_AMP_MUTE : 0; |
| 7690 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7691 | HDA_AMP_MUTE, bits); |
| 7692 | } |
| 7693 | |
| 7694 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7695 | unsigned int res) |
| 7696 | { |
| 7697 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7698 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7699 | } |
| 7700 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7701 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7702 | { |
| 7703 | unsigned int present; |
| 7704 | unsigned char bits; |
| 7705 | |
| 7706 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7707 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7708 | bits = present ? 0x80 : 0; |
| 7709 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7710 | 0x80, bits); |
| 7711 | } |
| 7712 | |
| 7713 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7714 | unsigned int res) |
| 7715 | { |
| 7716 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7717 | alc883_haier_w66_automute(codec); |
| 7718 | } |
| 7719 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7720 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7721 | { |
| 7722 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7723 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7724 | |
| 7725 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7726 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7727 | bits = present ? HDA_AMP_MUTE : 0; |
| 7728 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7729 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7730 | } |
| 7731 | |
| 7732 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7733 | { |
| 7734 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7735 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7736 | |
| 7737 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7738 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7739 | bits = present ? HDA_AMP_MUTE : 0; |
| 7740 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7741 | HDA_AMP_MUTE, bits); |
| 7742 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7743 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7744 | } |
| 7745 | |
| 7746 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7747 | unsigned int res) |
| 7748 | { |
| 7749 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7750 | alc883_lenovo_101e_all_automute(codec); |
| 7751 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7752 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7753 | } |
| 7754 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7755 | /* toggle speaker-output according to the hp-jack state */ |
| 7756 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7757 | { |
| 7758 | unsigned int present; |
| 7759 | |
| 7760 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7761 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7762 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7763 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7764 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7765 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7766 | } |
| 7767 | |
| 7768 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7769 | unsigned int res) |
| 7770 | { |
| 7771 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7772 | alc883_acer_aspire_automute(codec); |
| 7773 | } |
| 7774 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7775 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7776 | /* HP Pin: output 0 (0x0c) */ |
| 7777 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7778 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7779 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7780 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7781 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7782 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7783 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7784 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7785 | /* eanable EAPD on medion laptop */ |
| 7786 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7787 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7788 | /* enable unsolicited event */ |
| 7789 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7790 | { } |
| 7791 | }; |
| 7792 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7793 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7794 | { |
| 7795 | unsigned int present; |
| 7796 | |
| 7797 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7798 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7799 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7800 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7801 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7802 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7803 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7804 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7805 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7806 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7807 | } |
| 7808 | |
| 7809 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7810 | unsigned int res) |
| 7811 | { |
| 7812 | switch (res >> 26) { |
| 7813 | case ALC880_HP_EVENT: |
| 7814 | printk("hp_event\n"); |
| 7815 | alc888_6st_dell_front_automute(codec); |
| 7816 | break; |
| 7817 | } |
| 7818 | } |
| 7819 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7820 | /* |
| 7821 | * generic initialization of ADC, input mixers and output mixers |
| 7822 | */ |
| 7823 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7824 | /* |
| 7825 | * Unmute ADC0-2 and set the default input to mic-in |
| 7826 | */ |
| 7827 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7828 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7829 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7830 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7831 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7832 | /* 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] | 7833 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7834 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7835 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7836 | */ |
| 7837 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7838 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7839 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7840 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7841 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7842 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7843 | |
| 7844 | /* |
| 7845 | * Set up output mixers (0x0c - 0x0f) |
| 7846 | */ |
| 7847 | /* set vol=0 to output mixers */ |
| 7848 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7849 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7850 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7851 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7852 | /* set up input amps for analog loopback */ |
| 7853 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7854 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7855 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7856 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7857 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7858 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7859 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7860 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7861 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7862 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7863 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7864 | |
| 7865 | /* FIXME: use matrix-type input source selection */ |
| 7866 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7867 | /* Input mixer1 */ |
| 7868 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7869 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7870 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7871 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7872 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7873 | /* Input mixer2 */ |
| 7874 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7875 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7876 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7877 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7878 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7879 | |
| 7880 | { } |
| 7881 | }; |
| 7882 | |
| 7883 | /* capture mixer elements */ |
| 7884 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7885 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7886 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7887 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7888 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7889 | { |
| 7890 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7891 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7892 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7893 | */ |
| 7894 | /* .name = "Capture Source", */ |
| 7895 | .name = "Input Source", |
| 7896 | .count = 2, |
| 7897 | .info = alc882_mux_enum_info, |
| 7898 | .get = alc882_mux_enum_get, |
| 7899 | .put = alc882_mux_enum_put, |
| 7900 | }, |
| 7901 | { } /* end */ |
| 7902 | }; |
| 7903 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7904 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7905 | #define alc883_loopbacks alc880_loopbacks |
| 7906 | #endif |
| 7907 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7908 | /* pcm configuration: identiacal with ALC880 */ |
| 7909 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7910 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7911 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7912 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7913 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7914 | |
| 7915 | /* |
| 7916 | * configuration and preset |
| 7917 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7918 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7919 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7920 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7921 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7922 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7923 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7924 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7925 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7926 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7927 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7928 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7929 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7930 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7931 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7932 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7933 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7934 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7935 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7936 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7937 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7938 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7939 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7940 | [ALC883_AUTO] = "auto", |
| 7941 | }; |
| 7942 | |
| 7943 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7944 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7945 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7946 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7947 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 7948 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7949 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7950 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7951 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7952 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7953 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 7954 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7955 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 7956 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7957 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7958 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7959 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7960 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7961 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7962 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7963 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7964 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7965 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7966 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 7967 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7968 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7969 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7970 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7971 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7972 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7973 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7974 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7975 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7976 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7977 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7978 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7979 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 7980 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7981 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7982 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7983 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7984 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7985 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 7986 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7987 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7988 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7989 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7990 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7991 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7992 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7993 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7994 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7995 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 7996 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7997 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7998 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 7999 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8000 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8001 | {} |
| 8002 | }; |
| 8003 | |
| 8004 | static struct alc_config_preset alc883_presets[] = { |
| 8005 | [ALC883_3ST_2ch_DIG] = { |
| 8006 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8007 | .init_verbs = { alc883_init_verbs }, |
| 8008 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8009 | .dac_nids = alc883_dac_nids, |
| 8010 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8011 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8012 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8013 | .channel_mode = alc883_3ST_2ch_modes, |
| 8014 | .input_mux = &alc883_capture_source, |
| 8015 | }, |
| 8016 | [ALC883_3ST_6ch_DIG] = { |
| 8017 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8018 | .init_verbs = { alc883_init_verbs }, |
| 8019 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8020 | .dac_nids = alc883_dac_nids, |
| 8021 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8022 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8023 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8024 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8025 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8026 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8027 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8028 | [ALC883_3ST_6ch] = { |
| 8029 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8030 | .init_verbs = { alc883_init_verbs }, |
| 8031 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8032 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8033 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8034 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8035 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8036 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8037 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8038 | [ALC883_3ST_6ch_INTEL] = { |
| 8039 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8040 | .init_verbs = { alc883_init_verbs }, |
| 8041 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8042 | .dac_nids = alc883_dac_nids, |
| 8043 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8044 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8045 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8046 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8047 | .need_dac_fix = 1, |
| 8048 | .input_mux = &alc883_3stack_6ch_intel, |
| 8049 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8050 | [ALC883_6ST_DIG] = { |
| 8051 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8052 | .init_verbs = { alc883_init_verbs }, |
| 8053 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8054 | .dac_nids = alc883_dac_nids, |
| 8055 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8056 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8057 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8058 | .channel_mode = alc883_sixstack_modes, |
| 8059 | .input_mux = &alc883_capture_source, |
| 8060 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8061 | [ALC883_TARGA_DIG] = { |
| 8062 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8063 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8064 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8065 | .dac_nids = alc883_dac_nids, |
| 8066 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8067 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8068 | .channel_mode = alc883_3ST_6ch_modes, |
| 8069 | .need_dac_fix = 1, |
| 8070 | .input_mux = &alc883_capture_source, |
| 8071 | .unsol_event = alc883_tagra_unsol_event, |
| 8072 | .init_hook = alc883_tagra_automute, |
| 8073 | }, |
| 8074 | [ALC883_TARGA_2ch_DIG] = { |
| 8075 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8076 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8077 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8078 | .dac_nids = alc883_dac_nids, |
| 8079 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8080 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8081 | .channel_mode = alc883_3ST_2ch_modes, |
| 8082 | .input_mux = &alc883_capture_source, |
| 8083 | .unsol_event = alc883_tagra_unsol_event, |
| 8084 | .init_hook = alc883_tagra_automute, |
| 8085 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8086 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8087 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8088 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8089 | * and the headphone jack. Turn this on and rely on the |
| 8090 | * standard mute methods whenever the user wants to turn |
| 8091 | * these outputs off. |
| 8092 | */ |
| 8093 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8094 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8095 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8096 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8097 | .channel_mode = alc883_3ST_2ch_modes, |
| 8098 | .input_mux = &alc883_capture_source, |
| 8099 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8100 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8101 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8102 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8103 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8104 | .dac_nids = alc883_dac_nids, |
| 8105 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8106 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8107 | .channel_mode = alc883_3ST_2ch_modes, |
| 8108 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8109 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8110 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8111 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8112 | [ALC883_MEDION] = { |
| 8113 | .mixers = { alc883_fivestack_mixer, |
| 8114 | alc883_chmode_mixer }, |
| 8115 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8116 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8117 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8118 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8119 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8120 | .channel_mode = alc883_sixstack_modes, |
| 8121 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8122 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8123 | [ALC883_MEDION_MD2] = { |
| 8124 | .mixers = { alc883_medion_md2_mixer}, |
| 8125 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8126 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8127 | .dac_nids = alc883_dac_nids, |
| 8128 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8129 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8130 | .channel_mode = alc883_3ST_2ch_modes, |
| 8131 | .input_mux = &alc883_capture_source, |
| 8132 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8133 | .init_hook = alc883_medion_md2_automute, |
| 8134 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8135 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8136 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8137 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8138 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8139 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8140 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8141 | .channel_mode = alc883_3ST_2ch_modes, |
| 8142 | .input_mux = &alc883_capture_source, |
| 8143 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8144 | [ALC883_CLEVO_M720] = { |
| 8145 | .mixers = { alc883_clevo_m720_mixer }, |
| 8146 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8147 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8148 | .dac_nids = alc883_dac_nids, |
| 8149 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8150 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8151 | .channel_mode = alc883_3ST_2ch_modes, |
| 8152 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8153 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8154 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8155 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8156 | [ALC883_LENOVO_101E_2ch] = { |
| 8157 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8158 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8159 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8160 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8161 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8162 | .channel_mode = alc883_3ST_2ch_modes, |
| 8163 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8164 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8165 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8166 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8167 | [ALC883_LENOVO_NB0763] = { |
| 8168 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8169 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8170 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8171 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8172 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8173 | .channel_mode = alc883_3ST_2ch_modes, |
| 8174 | .need_dac_fix = 1, |
| 8175 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8176 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8177 | .init_hook = alc883_medion_md2_automute, |
| 8178 | }, |
| 8179 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8180 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8181 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8182 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8183 | .dac_nids = alc883_dac_nids, |
| 8184 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8185 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8186 | .channel_mode = alc883_3ST_6ch_modes, |
| 8187 | .need_dac_fix = 1, |
| 8188 | .input_mux = &alc883_capture_source, |
| 8189 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8190 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8191 | }, |
| 8192 | [ALC883_HAIER_W66] = { |
| 8193 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8194 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8195 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8196 | .dac_nids = alc883_dac_nids, |
| 8197 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8198 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8199 | .channel_mode = alc883_3ST_2ch_modes, |
| 8200 | .input_mux = &alc883_capture_source, |
| 8201 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8202 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8203 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8204 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8205 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8206 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8207 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8208 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8209 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8210 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8211 | .need_dac_fix = 1, |
| 8212 | .input_mux = &alc883_capture_source, |
| 8213 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8214 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8215 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8216 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8217 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8218 | .dac_nids = alc883_dac_nids, |
| 8219 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8220 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8221 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8222 | .channel_mode = alc883_sixstack_modes, |
| 8223 | .input_mux = &alc883_capture_source, |
| 8224 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8225 | .init_hook = alc888_6st_dell_front_automute, |
| 8226 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8227 | [ALC883_MITAC] = { |
| 8228 | .mixers = { alc883_mitac_mixer }, |
| 8229 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8230 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8231 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8232 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8233 | .channel_mode = alc883_3ST_2ch_modes, |
| 8234 | .input_mux = &alc883_capture_source, |
| 8235 | .unsol_event = alc883_mitac_unsol_event, |
| 8236 | .init_hook = alc883_mitac_automute, |
| 8237 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8238 | [ALC883_FUJITSU_PI2515] = { |
| 8239 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8240 | .init_verbs = { alc883_init_verbs, |
| 8241 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8242 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8243 | .dac_nids = alc883_dac_nids, |
| 8244 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8245 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8246 | .channel_mode = alc883_3ST_2ch_modes, |
| 8247 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8248 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8249 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8250 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8251 | }; |
| 8252 | |
| 8253 | |
| 8254 | /* |
| 8255 | * BIOS auto configuration |
| 8256 | */ |
| 8257 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8258 | hda_nid_t nid, int pin_type, |
| 8259 | int dac_idx) |
| 8260 | { |
| 8261 | /* set as output */ |
| 8262 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8263 | int idx; |
| 8264 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8265 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8266 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8267 | idx = 4; |
| 8268 | else |
| 8269 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8270 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8271 | |
| 8272 | } |
| 8273 | |
| 8274 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8275 | { |
| 8276 | struct alc_spec *spec = codec->spec; |
| 8277 | int i; |
| 8278 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8279 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8280 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8281 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8282 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8283 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8284 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8285 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8286 | } |
| 8287 | } |
| 8288 | |
| 8289 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8290 | { |
| 8291 | struct alc_spec *spec = codec->spec; |
| 8292 | hda_nid_t pin; |
| 8293 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8294 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8295 | if (pin) /* connect to front */ |
| 8296 | /* use dac 0 */ |
| 8297 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8298 | pin = spec->autocfg.speaker_pins[0]; |
| 8299 | if (pin) |
| 8300 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8301 | } |
| 8302 | |
| 8303 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8304 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8305 | |
| 8306 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8307 | { |
| 8308 | struct alc_spec *spec = codec->spec; |
| 8309 | int i; |
| 8310 | |
| 8311 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8312 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8313 | if (alc883_is_input_pin(nid)) { |
| 8314 | snd_hda_codec_write(codec, nid, 0, |
| 8315 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8316 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8317 | PIN_VREF80 : PIN_IN)); |
| 8318 | if (nid != ALC883_PIN_CD_NID) |
| 8319 | snd_hda_codec_write(codec, nid, 0, |
| 8320 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8321 | AMP_OUT_MUTE); |
| 8322 | } |
| 8323 | } |
| 8324 | } |
| 8325 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8326 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 8327 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8328 | /* almost identical with ALC880 parser... */ |
| 8329 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8330 | { |
| 8331 | struct alc_spec *spec = codec->spec; |
| 8332 | int err = alc880_parse_auto_config(codec); |
| 8333 | |
| 8334 | if (err < 0) |
| 8335 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8336 | else if (!err) |
| 8337 | return 0; /* no config found */ |
| 8338 | |
| 8339 | err = alc_auto_add_mic_boost(codec); |
| 8340 | if (err < 0) |
| 8341 | return err; |
| 8342 | |
| 8343 | /* hack - override the init verbs */ |
| 8344 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8345 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8346 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8347 | |
| 8348 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8349 | } |
| 8350 | |
| 8351 | /* additional initialization for auto-configuration model */ |
| 8352 | static void alc883_auto_init(struct hda_codec *codec) |
| 8353 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8354 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8355 | alc883_auto_init_multi_out(codec); |
| 8356 | alc883_auto_init_hp_out(codec); |
| 8357 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8358 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8359 | if (spec->unsol_event) |
| 8360 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8361 | } |
| 8362 | |
| 8363 | static int patch_alc883(struct hda_codec *codec) |
| 8364 | { |
| 8365 | struct alc_spec *spec; |
| 8366 | int err, board_config; |
| 8367 | |
| 8368 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8369 | if (spec == NULL) |
| 8370 | return -ENOMEM; |
| 8371 | |
| 8372 | codec->spec = spec; |
| 8373 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 8374 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 8375 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8376 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8377 | alc883_models, |
| 8378 | alc883_cfg_tbl); |
| 8379 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8380 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8381 | "trying auto-probe from BIOS...\n"); |
| 8382 | board_config = ALC883_AUTO; |
| 8383 | } |
| 8384 | |
| 8385 | if (board_config == ALC883_AUTO) { |
| 8386 | /* automatic parse from the BIOS config */ |
| 8387 | err = alc883_parse_auto_config(codec); |
| 8388 | if (err < 0) { |
| 8389 | alc_free(codec); |
| 8390 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8391 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8392 | printk(KERN_INFO |
| 8393 | "hda_codec: Cannot set up configuration " |
| 8394 | "from BIOS. Using base mode...\n"); |
| 8395 | board_config = ALC883_3ST_2ch_DIG; |
| 8396 | } |
| 8397 | } |
| 8398 | |
| 8399 | if (board_config != ALC883_AUTO) |
| 8400 | setup_preset(spec, &alc883_presets[board_config]); |
| 8401 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8402 | switch (codec->vendor_id) { |
| 8403 | case 0x10ec0888: |
| 8404 | spec->stream_name_analog = "ALC888 Analog"; |
| 8405 | spec->stream_name_digital = "ALC888 Digital"; |
| 8406 | break; |
| 8407 | case 0x10ec0889: |
| 8408 | spec->stream_name_analog = "ALC889 Analog"; |
| 8409 | spec->stream_name_digital = "ALC889 Digital"; |
| 8410 | break; |
| 8411 | default: |
| 8412 | spec->stream_name_analog = "ALC883 Analog"; |
| 8413 | spec->stream_name_digital = "ALC883 Digital"; |
| 8414 | break; |
| 8415 | } |
| 8416 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8417 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8418 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8419 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8420 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8421 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8422 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8423 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8424 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8425 | spec->adc_nids = alc883_adc_nids; |
| 8426 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8427 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8428 | spec->vmaster_nid = 0x0c; |
| 8429 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8430 | codec->patch_ops = alc_patch_ops; |
| 8431 | if (board_config == ALC883_AUTO) |
| 8432 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 8433 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8434 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8435 | if (!spec->loopback.amplist) |
| 8436 | spec->loopback.amplist = alc883_loopbacks; |
| 8437 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8438 | |
| 8439 | return 0; |
| 8440 | } |
| 8441 | |
| 8442 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8443 | * ALC262 support |
| 8444 | */ |
| 8445 | |
| 8446 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8447 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8448 | |
| 8449 | #define alc262_dac_nids alc260_dac_nids |
| 8450 | #define alc262_adc_nids alc882_adc_nids |
| 8451 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8452 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8453 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8454 | |
| 8455 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8456 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8457 | |
| 8458 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8459 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8460 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8461 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8462 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8463 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8464 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8465 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8466 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8467 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8468 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8469 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8470 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8471 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8472 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8473 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8474 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8475 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8476 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8477 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8478 | }; |
| 8479 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8480 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8481 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8482 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8483 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8484 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8485 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8486 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8487 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8488 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8489 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8490 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8491 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8492 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8493 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8494 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8495 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8496 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8497 | { } /* end */ |
| 8498 | }; |
| 8499 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8500 | /* update HP, line and mono-out pins according to the master switch */ |
| 8501 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8502 | { |
| 8503 | struct alc_spec *spec = codec->spec; |
| 8504 | int val = spec->master_sw; |
| 8505 | |
| 8506 | /* HP & line-out */ |
| 8507 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8508 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8509 | val ? PIN_HP : 0); |
| 8510 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8511 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8512 | val ? PIN_HP : 0); |
| 8513 | /* mono (speaker) depending on the HP jack sense */ |
| 8514 | val = val && !spec->jack_present; |
| 8515 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8516 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8517 | val ? PIN_OUT : 0); |
| 8518 | } |
| 8519 | |
| 8520 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8521 | { |
| 8522 | struct alc_spec *spec = codec->spec; |
| 8523 | unsigned int presence; |
| 8524 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8525 | AC_VERB_GET_PIN_SENSE, 0); |
| 8526 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8527 | alc262_hp_master_update(codec); |
| 8528 | } |
| 8529 | |
| 8530 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8531 | { |
| 8532 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8533 | return; |
| 8534 | alc262_hp_bpc_automute(codec); |
| 8535 | } |
| 8536 | |
| 8537 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8538 | { |
| 8539 | struct alc_spec *spec = codec->spec; |
| 8540 | unsigned int presence; |
| 8541 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8542 | AC_VERB_GET_PIN_SENSE, 0); |
| 8543 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8544 | alc262_hp_master_update(codec); |
| 8545 | } |
| 8546 | |
| 8547 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8548 | unsigned int res) |
| 8549 | { |
| 8550 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8551 | return; |
| 8552 | alc262_hp_wildwest_automute(codec); |
| 8553 | } |
| 8554 | |
| 8555 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8556 | struct snd_ctl_elem_value *ucontrol) |
| 8557 | { |
| 8558 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8559 | struct alc_spec *spec = codec->spec; |
| 8560 | *ucontrol->value.integer.value = spec->master_sw; |
| 8561 | return 0; |
| 8562 | } |
| 8563 | |
| 8564 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8565 | struct snd_ctl_elem_value *ucontrol) |
| 8566 | { |
| 8567 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8568 | struct alc_spec *spec = codec->spec; |
| 8569 | int val = !!*ucontrol->value.integer.value; |
| 8570 | |
| 8571 | if (val == spec->master_sw) |
| 8572 | return 0; |
| 8573 | spec->master_sw = val; |
| 8574 | alc262_hp_master_update(codec); |
| 8575 | return 1; |
| 8576 | } |
| 8577 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8578 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8579 | { |
| 8580 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8581 | .name = "Master Playback Switch", |
| 8582 | .info = snd_ctl_boolean_mono_info, |
| 8583 | .get = alc262_hp_master_sw_get, |
| 8584 | .put = alc262_hp_master_sw_put, |
| 8585 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8586 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8587 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8588 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8589 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8590 | HDA_OUTPUT), |
| 8591 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8592 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8593 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8594 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8595 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8596 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8597 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8598 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8599 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8600 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8601 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8602 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8603 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8604 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8605 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8606 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8607 | { } /* end */ |
| 8608 | }; |
| 8609 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8610 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8611 | { |
| 8612 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8613 | .name = "Master Playback Switch", |
| 8614 | .info = snd_ctl_boolean_mono_info, |
| 8615 | .get = alc262_hp_master_sw_get, |
| 8616 | .put = alc262_hp_master_sw_put, |
| 8617 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8618 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8619 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8620 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8621 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8622 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8623 | HDA_OUTPUT), |
| 8624 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8625 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8626 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8627 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8628 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8629 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8630 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8631 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8632 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8633 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8634 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8635 | { } /* end */ |
| 8636 | }; |
| 8637 | |
| 8638 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8639 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8640 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8641 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8642 | { } /* end */ |
| 8643 | }; |
| 8644 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8645 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8646 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8647 | { |
| 8648 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8649 | |
| 8650 | if (force || !spec->sense_updated) { |
| 8651 | unsigned int present; |
| 8652 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8653 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8654 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8655 | spec->sense_updated = 1; |
| 8656 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8657 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8658 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8659 | } |
| 8660 | |
| 8661 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8662 | unsigned int res) |
| 8663 | { |
| 8664 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8665 | return; |
| 8666 | alc262_hp_t5735_automute(codec, 1); |
| 8667 | } |
| 8668 | |
| 8669 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8670 | { |
| 8671 | alc262_hp_t5735_automute(codec, 1); |
| 8672 | } |
| 8673 | |
| 8674 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8675 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8676 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8677 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8678 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8679 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8680 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8681 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8682 | { } /* end */ |
| 8683 | }; |
| 8684 | |
| 8685 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8686 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8687 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8688 | |
| 8689 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8690 | { } |
| 8691 | }; |
| 8692 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8693 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8694 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8695 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8696 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8697 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8698 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8699 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8700 | { } /* end */ |
| 8701 | }; |
| 8702 | |
| 8703 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8704 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8705 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8706 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8707 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8708 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8709 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8710 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8711 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8712 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8713 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8714 | {} |
| 8715 | }; |
| 8716 | |
| 8717 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8718 | .num_items = 1, |
| 8719 | .items = { |
| 8720 | { "Line", 0x1 }, |
| 8721 | }, |
| 8722 | }; |
| 8723 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8724 | /* bind hp and internal speaker mute (with plug check) */ |
| 8725 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8726 | struct snd_ctl_elem_value *ucontrol) |
| 8727 | { |
| 8728 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8729 | long *valp = ucontrol->value.integer.value; |
| 8730 | int change; |
| 8731 | |
| 8732 | /* change hp mute */ |
| 8733 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8734 | HDA_AMP_MUTE, |
| 8735 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8736 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8737 | HDA_AMP_MUTE, |
| 8738 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8739 | if (change) { |
| 8740 | /* change speaker according to HP jack state */ |
| 8741 | struct alc_spec *spec = codec->spec; |
| 8742 | unsigned int mute; |
| 8743 | if (spec->jack_present) |
| 8744 | mute = HDA_AMP_MUTE; |
| 8745 | else |
| 8746 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8747 | HDA_OUTPUT, 0); |
| 8748 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8749 | HDA_AMP_MUTE, mute); |
| 8750 | } |
| 8751 | return change; |
| 8752 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8753 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8754 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8755 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8756 | { |
| 8757 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8758 | .name = "Master Playback Switch", |
| 8759 | .info = snd_hda_mixer_amp_switch_info, |
| 8760 | .get = snd_hda_mixer_amp_switch_get, |
| 8761 | .put = alc262_sony_master_sw_put, |
| 8762 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8763 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8765 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8766 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8767 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8768 | { } /* end */ |
| 8769 | }; |
| 8770 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8771 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8772 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8773 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8774 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8775 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8776 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8777 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8778 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8779 | { } /* end */ |
| 8780 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8781 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8782 | #define alc262_capture_mixer alc882_capture_mixer |
| 8783 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8784 | |
| 8785 | /* |
| 8786 | * generic initialization of ADC, input mixers and output mixers |
| 8787 | */ |
| 8788 | static struct hda_verb alc262_init_verbs[] = { |
| 8789 | /* |
| 8790 | * Unmute ADC0-2 and set the default input to mic-in |
| 8791 | */ |
| 8792 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8793 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8794 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8795 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8796 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8797 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8798 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8799 | /* 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] | 8800 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8801 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8802 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8803 | */ |
| 8804 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8805 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8806 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8807 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8808 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8809 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8810 | |
| 8811 | /* |
| 8812 | * Set up output mixers (0x0c - 0x0e) |
| 8813 | */ |
| 8814 | /* set vol=0 to output mixers */ |
| 8815 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8816 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8817 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8818 | /* set up input amps for analog loopback */ |
| 8819 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8820 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8821 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8822 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8823 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8824 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8825 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8826 | |
| 8827 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8828 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8829 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8830 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8831 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8832 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8833 | |
| 8834 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8835 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8836 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8837 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8838 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8839 | |
| 8840 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8841 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8842 | |
| 8843 | /* FIXME: use matrix-type input source selection */ |
| 8844 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8845 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8846 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8847 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8848 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8849 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8850 | /* Input mixer2 */ |
| 8851 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8852 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8853 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8854 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8855 | /* Input mixer3 */ |
| 8856 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8857 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8858 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8859 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8860 | |
| 8861 | { } |
| 8862 | }; |
| 8863 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8864 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8865 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8866 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8867 | {} |
| 8868 | }; |
| 8869 | |
| 8870 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8871 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8872 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8873 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8874 | |
| 8875 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8876 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8877 | {} |
| 8878 | }; |
| 8879 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8880 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8881 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8882 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8883 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8884 | |
| 8885 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8886 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 8887 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8888 | }; |
| 8889 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8890 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8891 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8892 | { |
| 8893 | struct alc_spec *spec = codec->spec; |
| 8894 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8895 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8896 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8897 | /* need to execute and sync at first */ |
| 8898 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8899 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8900 | AC_VERB_GET_PIN_SENSE, 0); |
| 8901 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8902 | if (spec->jack_present) { |
| 8903 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8904 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8905 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8906 | } else { |
| 8907 | /* unmute internal speaker if necessary */ |
| 8908 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8909 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8910 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8911 | } |
| 8912 | } |
| 8913 | |
| 8914 | /* unsolicited event for HP jack sensing */ |
| 8915 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8916 | unsigned int res) |
| 8917 | { |
| 8918 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8919 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8920 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8921 | } |
| 8922 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8923 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8924 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8925 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8926 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8927 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8928 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8929 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8930 | AC_VERB_GET_PIN_SENSE, 0); |
| 8931 | present = (present & 0x80000000) != 0; |
| 8932 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8933 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8934 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8935 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8936 | } else { |
| 8937 | /* unmute internal speaker if necessary */ |
| 8938 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8939 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8940 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8941 | } |
| 8942 | } |
| 8943 | |
| 8944 | /* unsolicited event for HP jack sensing */ |
| 8945 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8946 | unsigned int res) |
| 8947 | { |
| 8948 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8949 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8950 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8951 | } |
| 8952 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8953 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 8954 | * nec model |
| 8955 | * 0x15 = headphone |
| 8956 | * 0x16 = internal speaker |
| 8957 | * 0x18 = external mic |
| 8958 | */ |
| 8959 | |
| 8960 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 8961 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8962 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 8963 | |
| 8964 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8965 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8966 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8967 | |
| 8968 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8969 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8970 | { } /* end */ |
| 8971 | }; |
| 8972 | |
| 8973 | static struct hda_verb alc262_nec_verbs[] = { |
| 8974 | /* Unmute Speaker */ |
| 8975 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8976 | |
| 8977 | /* Headphone */ |
| 8978 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8979 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8980 | |
| 8981 | /* External mic to headphone */ |
| 8982 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8983 | /* External mic to speaker */ |
| 8984 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8985 | {} |
| 8986 | }; |
| 8987 | |
| 8988 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8989 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8990 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 8991 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8992 | */ |
| 8993 | |
| 8994 | #define ALC_HP_EVENT 0x37 |
| 8995 | |
| 8996 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8997 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8998 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8999 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9000 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9001 | {} |
| 9002 | }; |
| 9003 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9004 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9005 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9006 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9007 | {} |
| 9008 | }; |
| 9009 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9010 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9011 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9012 | .items = { |
| 9013 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9014 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9015 | { "CD", 0x4 }, |
| 9016 | }, |
| 9017 | }; |
| 9018 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9019 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9020 | .num_items = 5, |
| 9021 | .items = { |
| 9022 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9023 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9024 | { "Line", 0x2 }, |
| 9025 | { "CD", 0x4 }, |
| 9026 | { "AUX IN", 0x6 }, |
| 9027 | }, |
| 9028 | }; |
| 9029 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9030 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9031 | .num_items = 4, |
| 9032 | .items = { |
| 9033 | { "Mic", 0x0 }, |
| 9034 | { "Front Mic", 0x2 }, |
| 9035 | { "Line", 0x1 }, |
| 9036 | { "CD", 0x4 }, |
| 9037 | }, |
| 9038 | }; |
| 9039 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9040 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9041 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9042 | { |
| 9043 | struct alc_spec *spec = codec->spec; |
| 9044 | unsigned int mute; |
| 9045 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9046 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9047 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9048 | /* need to execute and sync at first */ |
| 9049 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9050 | /* check laptop HP jack */ |
| 9051 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9052 | AC_VERB_GET_PIN_SENSE, 0); |
| 9053 | /* need to execute and sync at first */ |
| 9054 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9055 | /* check docking HP jack */ |
| 9056 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9057 | AC_VERB_GET_PIN_SENSE, 0); |
| 9058 | if (present & AC_PINSENSE_PRESENCE) |
| 9059 | spec->jack_present = 1; |
| 9060 | else |
| 9061 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9062 | spec->sense_updated = 1; |
| 9063 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9064 | /* unmute internal speaker only if both HPs are unplugged and |
| 9065 | * master switch is on |
| 9066 | */ |
| 9067 | if (spec->jack_present) |
| 9068 | mute = HDA_AMP_MUTE; |
| 9069 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9070 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9071 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9072 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9073 | } |
| 9074 | |
| 9075 | /* unsolicited event for HP jack sensing */ |
| 9076 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9077 | unsigned int res) |
| 9078 | { |
| 9079 | if ((res >> 26) != ALC_HP_EVENT) |
| 9080 | return; |
| 9081 | alc262_fujitsu_automute(codec, 1); |
| 9082 | } |
| 9083 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9084 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9085 | { |
| 9086 | alc262_fujitsu_automute(codec, 1); |
| 9087 | } |
| 9088 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9089 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9090 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 9091 | .ops = &snd_hda_bind_vol, |
| 9092 | .values = { |
| 9093 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 9094 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 9095 | 0 |
| 9096 | }, |
| 9097 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9098 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9099 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9100 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 9101 | { |
| 9102 | struct alc_spec *spec = codec->spec; |
| 9103 | unsigned int mute; |
| 9104 | |
| 9105 | if (force || !spec->sense_updated) { |
| 9106 | unsigned int present_int_hp; |
| 9107 | /* need to execute and sync at first */ |
| 9108 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9109 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 9110 | AC_VERB_GET_PIN_SENSE, 0); |
| 9111 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 9112 | spec->sense_updated = 1; |
| 9113 | } |
| 9114 | if (spec->jack_present) { |
| 9115 | /* mute internal speaker */ |
| 9116 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9117 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9118 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9119 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9120 | } else { |
| 9121 | /* unmute internal speaker if necessary */ |
| 9122 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9123 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9124 | HDA_AMP_MUTE, mute); |
| 9125 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9126 | HDA_AMP_MUTE, mute); |
| 9127 | } |
| 9128 | } |
| 9129 | |
| 9130 | /* unsolicited event for HP jack sensing */ |
| 9131 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 9132 | unsigned int res) |
| 9133 | { |
| 9134 | if ((res >> 26) != ALC_HP_EVENT) |
| 9135 | return; |
| 9136 | alc262_lenovo_3000_automute(codec, 1); |
| 9137 | } |
| 9138 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9139 | /* bind hp and internal speaker mute (with plug check) */ |
| 9140 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9141 | struct snd_ctl_elem_value *ucontrol) |
| 9142 | { |
| 9143 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9144 | long *valp = ucontrol->value.integer.value; |
| 9145 | int change; |
| 9146 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9147 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9148 | HDA_AMP_MUTE, |
| 9149 | valp ? 0 : HDA_AMP_MUTE); |
| 9150 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9151 | HDA_AMP_MUTE, |
| 9152 | valp ? 0 : HDA_AMP_MUTE); |
| 9153 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 9154 | if (change) |
| 9155 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9156 | return change; |
| 9157 | } |
| 9158 | |
| 9159 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9160 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9161 | { |
| 9162 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9163 | .name = "Master Playback Switch", |
| 9164 | .info = snd_hda_mixer_amp_switch_info, |
| 9165 | .get = snd_hda_mixer_amp_switch_get, |
| 9166 | .put = alc262_fujitsu_master_sw_put, |
| 9167 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9168 | }, |
| 9169 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9170 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 9171 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 9172 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9173 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9174 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9175 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9176 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9177 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9178 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9179 | { } /* end */ |
| 9180 | }; |
| 9181 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9182 | /* bind hp and internal speaker mute (with plug check) */ |
| 9183 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9184 | struct snd_ctl_elem_value *ucontrol) |
| 9185 | { |
| 9186 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9187 | long *valp = ucontrol->value.integer.value; |
| 9188 | int change; |
| 9189 | |
| 9190 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9191 | HDA_AMP_MUTE, |
| 9192 | valp ? 0 : HDA_AMP_MUTE); |
| 9193 | |
| 9194 | if (change) |
| 9195 | alc262_lenovo_3000_automute(codec, 0); |
| 9196 | return change; |
| 9197 | } |
| 9198 | |
| 9199 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 9200 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9201 | { |
| 9202 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9203 | .name = "Master Playback Switch", |
| 9204 | .info = snd_hda_mixer_amp_switch_info, |
| 9205 | .get = snd_hda_mixer_amp_switch_get, |
| 9206 | .put = alc262_lenovo_3000_master_sw_put, |
| 9207 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 9208 | }, |
| 9209 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9210 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9211 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9212 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9213 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9214 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9215 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9216 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9217 | { } /* end */ |
| 9218 | }; |
| 9219 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9220 | /* additional init verbs for Benq laptops */ |
| 9221 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 9222 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9223 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9224 | {} |
| 9225 | }; |
| 9226 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9227 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 9228 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9229 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9230 | |
| 9231 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9232 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 9233 | {} |
| 9234 | }; |
| 9235 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9236 | /* Samsung Q1 Ultra Vista model setup */ |
| 9237 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9238 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9239 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9240 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9241 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9242 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9243 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9244 | { } /* end */ |
| 9245 | }; |
| 9246 | |
| 9247 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9248 | /* output mixer */ |
| 9249 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9250 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9251 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9252 | /* speaker */ |
| 9253 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9254 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9255 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9256 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9257 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9258 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9259 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9260 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9261 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9262 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9263 | /* internal mic */ |
| 9264 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9265 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9266 | /* ADC, choose mic */ |
| 9267 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9268 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9269 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9270 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9271 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9272 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9273 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9274 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9275 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 9276 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9277 | {} |
| 9278 | }; |
| 9279 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9280 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9281 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9282 | { |
| 9283 | struct alc_spec *spec = codec->spec; |
| 9284 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9285 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9286 | mute = 0; |
| 9287 | /* auto-mute only when HP is used as HP */ |
| 9288 | if (!spec->cur_mux[0]) { |
| 9289 | unsigned int present; |
| 9290 | /* need to execute and sync at first */ |
| 9291 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9292 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9293 | AC_VERB_GET_PIN_SENSE, 0); |
| 9294 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9295 | if (spec->jack_present) |
| 9296 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9297 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9298 | /* mute/unmute internal speaker */ |
| 9299 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9300 | HDA_AMP_MUTE, mute); |
| 9301 | /* mute/unmute HP */ |
| 9302 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9303 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9304 | } |
| 9305 | |
| 9306 | /* unsolicited event for HP jack sensing */ |
| 9307 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9308 | unsigned int res) |
| 9309 | { |
| 9310 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9311 | return; |
| 9312 | alc262_ultra_automute(codec); |
| 9313 | } |
| 9314 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9315 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9316 | .num_items = 2, |
| 9317 | .items = { |
| 9318 | { "Mic", 0x1 }, |
| 9319 | { "Headphone", 0x7 }, |
| 9320 | }, |
| 9321 | }; |
| 9322 | |
| 9323 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9324 | struct snd_ctl_elem_value *ucontrol) |
| 9325 | { |
| 9326 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9327 | struct alc_spec *spec = codec->spec; |
| 9328 | int ret; |
| 9329 | |
| 9330 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 9331 | if (!ret) |
| 9332 | return 0; |
| 9333 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9334 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9335 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9336 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9337 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9338 | return ret; |
| 9339 | } |
| 9340 | |
| 9341 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9342 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9343 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9344 | { |
| 9345 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9346 | .name = "Capture Source", |
| 9347 | .info = alc882_mux_enum_info, |
| 9348 | .get = alc882_mux_enum_get, |
| 9349 | .put = alc262_ultra_mux_enum_put, |
| 9350 | }, |
| 9351 | { } /* end */ |
| 9352 | }; |
| 9353 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9354 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9355 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9356 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9357 | { |
| 9358 | hda_nid_t nid; |
| 9359 | int err; |
| 9360 | |
| 9361 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9362 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9363 | spec->multiout.dac_nids[0] = 2; |
| 9364 | |
| 9365 | nid = cfg->line_out_pins[0]; |
| 9366 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9367 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9368 | "Front Playback Volume", |
| 9369 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9370 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9371 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9372 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9373 | "Front Playback Switch", |
| 9374 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9375 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9376 | return err; |
| 9377 | } |
| 9378 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9379 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9380 | if (nid) { |
| 9381 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9382 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9383 | "Speaker Playback Volume", |
| 9384 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9385 | HDA_OUTPUT)); |
| 9386 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9387 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9388 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9389 | "Speaker Playback Switch", |
| 9390 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9391 | HDA_OUTPUT)); |
| 9392 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9393 | return err; |
| 9394 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9395 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9396 | "Speaker Playback Switch", |
| 9397 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9398 | HDA_OUTPUT)); |
| 9399 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9400 | return err; |
| 9401 | } |
| 9402 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9403 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9404 | if (nid) { |
| 9405 | /* spec->multiout.hp_nid = 2; */ |
| 9406 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9407 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9408 | "Headphone Playback Volume", |
| 9409 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9410 | HDA_OUTPUT)); |
| 9411 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9412 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9413 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9414 | "Headphone Playback Switch", |
| 9415 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9416 | HDA_OUTPUT)); |
| 9417 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9418 | return err; |
| 9419 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9420 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9421 | "Headphone Playback Switch", |
| 9422 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9423 | HDA_OUTPUT)); |
| 9424 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9425 | return err; |
| 9426 | } |
| 9427 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9428 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9429 | } |
| 9430 | |
| 9431 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9432 | #define alc262_auto_create_analog_input_ctls \ |
| 9433 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9434 | |
| 9435 | /* |
| 9436 | * generic initialization of ADC, input mixers and output mixers |
| 9437 | */ |
| 9438 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9439 | /* |
| 9440 | * Unmute ADC0-2 and set the default input to mic-in |
| 9441 | */ |
| 9442 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9443 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9444 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9445 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9446 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9447 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9448 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9449 | /* 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] | 9450 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9451 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9452 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9453 | */ |
| 9454 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9455 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9456 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9457 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9458 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9459 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9460 | |
| 9461 | /* |
| 9462 | * Set up output mixers (0x0c - 0x0f) |
| 9463 | */ |
| 9464 | /* set vol=0 to output mixers */ |
| 9465 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9466 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9467 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9468 | |
| 9469 | /* set up input amps for analog loopback */ |
| 9470 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9471 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9473 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9474 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9475 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9476 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9477 | |
| 9478 | /* FIXME: use matrix-type input source selection */ |
| 9479 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9480 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9481 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9482 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9483 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9484 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9485 | /* Input mixer2 */ |
| 9486 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9487 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9488 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9489 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9490 | /* Input mixer3 */ |
| 9491 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9492 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9493 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9495 | |
| 9496 | { } |
| 9497 | }; |
| 9498 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9499 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9500 | /* |
| 9501 | * Unmute ADC0-2 and set the default input to mic-in |
| 9502 | */ |
| 9503 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9505 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9506 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9507 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9508 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9509 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9510 | /* 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] | 9511 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9512 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9513 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9514 | */ |
| 9515 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9516 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9517 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9520 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9521 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9522 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9523 | |
| 9524 | /* |
| 9525 | * Set up output mixers (0x0c - 0x0e) |
| 9526 | */ |
| 9527 | /* set vol=0 to output mixers */ |
| 9528 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9529 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9530 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9531 | |
| 9532 | /* set up input amps for analog loopback */ |
| 9533 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9534 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9535 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9536 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9537 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9538 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9539 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9540 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9541 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9542 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9543 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9544 | |
| 9545 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9546 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9547 | |
| 9548 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9549 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9550 | |
| 9551 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9552 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9553 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9554 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9555 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9556 | |
| 9557 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9558 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9559 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9560 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9561 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9562 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9563 | |
| 9564 | |
| 9565 | /* FIXME: use matrix-type input source selection */ |
| 9566 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9567 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9568 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9569 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9570 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9571 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9572 | /* Input mixer2 */ |
| 9573 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9574 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9575 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9576 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9577 | /* Input mixer3 */ |
| 9578 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9579 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9580 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9581 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9582 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9583 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9584 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9585 | { } |
| 9586 | }; |
| 9587 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9588 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9589 | /* |
| 9590 | * Unmute ADC0-2 and set the default input to mic-in |
| 9591 | */ |
| 9592 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9593 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9594 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9595 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9596 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9597 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9598 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9599 | /* 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] | 9600 | * mixer widget |
| 9601 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9602 | * panel mic (mic 2) |
| 9603 | */ |
| 9604 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9605 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9606 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9607 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9608 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9609 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9610 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9611 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9612 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9613 | /* |
| 9614 | * Set up output mixers (0x0c - 0x0e) |
| 9615 | */ |
| 9616 | /* set vol=0 to output mixers */ |
| 9617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9618 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9619 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9620 | |
| 9621 | /* set up input amps for analog loopback */ |
| 9622 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9623 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9624 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9625 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9626 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9627 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9628 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9629 | |
| 9630 | |
| 9631 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9632 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9633 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9634 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9635 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9636 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9637 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9638 | |
| 9639 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9640 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9641 | |
| 9642 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9643 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9644 | |
| 9645 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9646 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9647 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9648 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9649 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9650 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9651 | |
| 9652 | /* FIXME: use matrix-type input source selection */ |
| 9653 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9654 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9655 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9656 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9657 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9658 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9659 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9660 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9661 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9662 | /* Input mixer2 */ |
| 9663 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9664 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9665 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9666 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9667 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9668 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9669 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9670 | /* Input mixer3 */ |
| 9671 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9675 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9676 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9677 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9678 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9679 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9680 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9681 | { } |
| 9682 | }; |
| 9683 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9684 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9685 | #define alc262_loopbacks alc880_loopbacks |
| 9686 | #endif |
| 9687 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9688 | /* pcm configuration: identiacal with ALC880 */ |
| 9689 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9690 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9691 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9692 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9693 | |
| 9694 | /* |
| 9695 | * BIOS auto configuration |
| 9696 | */ |
| 9697 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9698 | { |
| 9699 | struct alc_spec *spec = codec->spec; |
| 9700 | int err; |
| 9701 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9702 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9703 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9704 | alc262_ignore); |
| 9705 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9706 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9707 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9708 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9709 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9710 | if (err < 0) |
| 9711 | return err; |
| 9712 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9713 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9714 | return err; |
| 9715 | |
| 9716 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9717 | |
| 9718 | if (spec->autocfg.dig_out_pin) |
| 9719 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9720 | if (spec->autocfg.dig_in_pin) |
| 9721 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9722 | |
| 9723 | if (spec->kctl_alloc) |
| 9724 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9725 | |
| 9726 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9727 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9728 | spec->input_mux = &spec->private_imux; |
| 9729 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9730 | err = alc_auto_add_mic_boost(codec); |
| 9731 | if (err < 0) |
| 9732 | return err; |
| 9733 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9734 | return 1; |
| 9735 | } |
| 9736 | |
| 9737 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9738 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9739 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9740 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9741 | |
| 9742 | |
| 9743 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9744 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9745 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9746 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9747 | alc262_auto_init_multi_out(codec); |
| 9748 | alc262_auto_init_hp_out(codec); |
| 9749 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9750 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9751 | if (spec->unsol_event) |
| 9752 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9753 | } |
| 9754 | |
| 9755 | /* |
| 9756 | * configuration and preset |
| 9757 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9758 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9759 | [ALC262_BASIC] = "basic", |
| 9760 | [ALC262_HIPPO] = "hippo", |
| 9761 | [ALC262_HIPPO_1] = "hippo_1", |
| 9762 | [ALC262_FUJITSU] = "fujitsu", |
| 9763 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9764 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9765 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9766 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9767 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9768 | [ALC262_BENQ_T31] = "benq-t31", |
| 9769 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9770 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9771 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9772 | [ALC262_NEC] = "nec", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9773 | [ALC262_AUTO] = "auto", |
| 9774 | }; |
| 9775 | |
| 9776 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9777 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9778 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9779 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9780 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9781 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9782 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9783 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9784 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9785 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9786 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9787 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9788 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9789 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9790 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9791 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9792 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9793 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9794 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9795 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9796 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9797 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9798 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9799 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9800 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9801 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9802 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9803 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9804 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9805 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 9806 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
| 9807 | ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9808 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9809 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9810 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9811 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9812 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9813 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9814 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9815 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9816 | {} |
| 9817 | }; |
| 9818 | |
| 9819 | static struct alc_config_preset alc262_presets[] = { |
| 9820 | [ALC262_BASIC] = { |
| 9821 | .mixers = { alc262_base_mixer }, |
| 9822 | .init_verbs = { alc262_init_verbs }, |
| 9823 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9824 | .dac_nids = alc262_dac_nids, |
| 9825 | .hp_nid = 0x03, |
| 9826 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9827 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9828 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9829 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9830 | [ALC262_HIPPO] = { |
| 9831 | .mixers = { alc262_base_mixer }, |
| 9832 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9833 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9834 | .dac_nids = alc262_dac_nids, |
| 9835 | .hp_nid = 0x03, |
| 9836 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9837 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9838 | .channel_mode = alc262_modes, |
| 9839 | .input_mux = &alc262_capture_source, |
| 9840 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9841 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9842 | }, |
| 9843 | [ALC262_HIPPO_1] = { |
| 9844 | .mixers = { alc262_hippo1_mixer }, |
| 9845 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9846 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9847 | .dac_nids = alc262_dac_nids, |
| 9848 | .hp_nid = 0x02, |
| 9849 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9850 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9851 | .channel_mode = alc262_modes, |
| 9852 | .input_mux = &alc262_capture_source, |
| 9853 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9854 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9855 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9856 | [ALC262_FUJITSU] = { |
| 9857 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9858 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9859 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9860 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9861 | .dac_nids = alc262_dac_nids, |
| 9862 | .hp_nid = 0x03, |
| 9863 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9864 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9865 | .channel_mode = alc262_modes, |
| 9866 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9867 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9868 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9869 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9870 | [ALC262_HP_BPC] = { |
| 9871 | .mixers = { alc262_HP_BPC_mixer }, |
| 9872 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9873 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9874 | .dac_nids = alc262_dac_nids, |
| 9875 | .hp_nid = 0x03, |
| 9876 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9877 | .channel_mode = alc262_modes, |
| 9878 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9879 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 9880 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9881 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9882 | [ALC262_HP_BPC_D7000_WF] = { |
| 9883 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9884 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9885 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9886 | .dac_nids = alc262_dac_nids, |
| 9887 | .hp_nid = 0x03, |
| 9888 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9889 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9890 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9891 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9892 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9893 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9894 | [ALC262_HP_BPC_D7000_WL] = { |
| 9895 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9896 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9897 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9898 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9899 | .dac_nids = alc262_dac_nids, |
| 9900 | .hp_nid = 0x03, |
| 9901 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9902 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9903 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9904 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9905 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9906 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9907 | [ALC262_HP_TC_T5735] = { |
| 9908 | .mixers = { alc262_hp_t5735_mixer }, |
| 9909 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9910 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9911 | .dac_nids = alc262_dac_nids, |
| 9912 | .hp_nid = 0x03, |
| 9913 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9914 | .channel_mode = alc262_modes, |
| 9915 | .input_mux = &alc262_capture_source, |
| 9916 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9917 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9918 | }, |
| 9919 | [ALC262_HP_RP5700] = { |
| 9920 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9921 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9922 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9923 | .dac_nids = alc262_dac_nids, |
| 9924 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9925 | .channel_mode = alc262_modes, |
| 9926 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9927 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9928 | [ALC262_BENQ_ED8] = { |
| 9929 | .mixers = { alc262_base_mixer }, |
| 9930 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9931 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9932 | .dac_nids = alc262_dac_nids, |
| 9933 | .hp_nid = 0x03, |
| 9934 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9935 | .channel_mode = alc262_modes, |
| 9936 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9937 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9938 | [ALC262_SONY_ASSAMD] = { |
| 9939 | .mixers = { alc262_sony_mixer }, |
| 9940 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9941 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9942 | .dac_nids = alc262_dac_nids, |
| 9943 | .hp_nid = 0x02, |
| 9944 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9945 | .channel_mode = alc262_modes, |
| 9946 | .input_mux = &alc262_capture_source, |
| 9947 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9948 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9949 | }, |
| 9950 | [ALC262_BENQ_T31] = { |
| 9951 | .mixers = { alc262_benq_t31_mixer }, |
| 9952 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9953 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9954 | .dac_nids = alc262_dac_nids, |
| 9955 | .hp_nid = 0x03, |
| 9956 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9957 | .channel_mode = alc262_modes, |
| 9958 | .input_mux = &alc262_capture_source, |
| 9959 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9960 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9961 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9962 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9963 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 9964 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9965 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9966 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9967 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9968 | .channel_mode = alc262_modes, |
| 9969 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9970 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 9971 | .capsrc_nids = alc262_capsrc_nids, |
| 9972 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9973 | .unsol_event = alc262_ultra_unsol_event, |
| 9974 | .init_hook = alc262_ultra_automute, |
| 9975 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9976 | [ALC262_LENOVO_3000] = { |
| 9977 | .mixers = { alc262_lenovo_3000_mixer }, |
| 9978 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9979 | alc262_lenovo_3000_unsol_verbs }, |
| 9980 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9981 | .dac_nids = alc262_dac_nids, |
| 9982 | .hp_nid = 0x03, |
| 9983 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9984 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9985 | .channel_mode = alc262_modes, |
| 9986 | .input_mux = &alc262_fujitsu_capture_source, |
| 9987 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 9988 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9989 | [ALC262_NEC] = { |
| 9990 | .mixers = { alc262_nec_mixer }, |
| 9991 | .init_verbs = { alc262_nec_verbs }, |
| 9992 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9993 | .dac_nids = alc262_dac_nids, |
| 9994 | .hp_nid = 0x03, |
| 9995 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9996 | .channel_mode = alc262_modes, |
| 9997 | .input_mux = &alc262_capture_source, |
| 9998 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9999 | }; |
| 10000 | |
| 10001 | static int patch_alc262(struct hda_codec *codec) |
| 10002 | { |
| 10003 | struct alc_spec *spec; |
| 10004 | int board_config; |
| 10005 | int err; |
| 10006 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 10007 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10008 | if (spec == NULL) |
| 10009 | return -ENOMEM; |
| 10010 | |
| 10011 | codec->spec = spec; |
| 10012 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10013 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 10014 | * under-run |
| 10015 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10016 | { |
| 10017 | int tmp; |
| 10018 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10019 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 10020 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10021 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 10022 | } |
| 10023 | #endif |
| 10024 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 10025 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10026 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10027 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 10028 | alc262_models, |
| 10029 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10030 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10031 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10032 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 10033 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10034 | board_config = ALC262_AUTO; |
| 10035 | } |
| 10036 | |
| 10037 | if (board_config == ALC262_AUTO) { |
| 10038 | /* automatic parse from the BIOS config */ |
| 10039 | err = alc262_parse_auto_config(codec); |
| 10040 | if (err < 0) { |
| 10041 | alc_free(codec); |
| 10042 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10043 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10044 | printk(KERN_INFO |
| 10045 | "hda_codec: Cannot set up configuration " |
| 10046 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10047 | board_config = ALC262_BASIC; |
| 10048 | } |
| 10049 | } |
| 10050 | |
| 10051 | if (board_config != ALC262_AUTO) |
| 10052 | setup_preset(spec, &alc262_presets[board_config]); |
| 10053 | |
| 10054 | spec->stream_name_analog = "ALC262 Analog"; |
| 10055 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 10056 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 10057 | |
| 10058 | spec->stream_name_digital = "ALC262 Digital"; |
| 10059 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 10060 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 10061 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10062 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10063 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 10064 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 10065 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10066 | /* get type */ |
| 10067 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10068 | if (wcap != AC_WID_AUD_IN) { |
| 10069 | spec->adc_nids = alc262_adc_nids_alt; |
| 10070 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10071 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10072 | spec->mixers[spec->num_mixers] = |
| 10073 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10074 | spec->num_mixers++; |
| 10075 | } else { |
| 10076 | spec->adc_nids = alc262_adc_nids; |
| 10077 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10078 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10079 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 10080 | spec->num_mixers++; |
| 10081 | } |
| 10082 | } |
| 10083 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10084 | spec->vmaster_nid = 0x0c; |
| 10085 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10086 | codec->patch_ops = alc_patch_ops; |
| 10087 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10088 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10089 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10090 | if (!spec->loopback.amplist) |
| 10091 | spec->loopback.amplist = alc262_loopbacks; |
| 10092 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10093 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10094 | return 0; |
| 10095 | } |
| 10096 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10097 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10098 | * ALC268 channel source setting (2 channel) |
| 10099 | */ |
| 10100 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 10101 | #define alc268_modes alc260_modes |
| 10102 | |
| 10103 | static hda_nid_t alc268_dac_nids[2] = { |
| 10104 | /* front, hp */ |
| 10105 | 0x02, 0x03 |
| 10106 | }; |
| 10107 | |
| 10108 | static hda_nid_t alc268_adc_nids[2] = { |
| 10109 | /* ADC0-1 */ |
| 10110 | 0x08, 0x07 |
| 10111 | }; |
| 10112 | |
| 10113 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 10114 | /* ADC0 */ |
| 10115 | 0x08 |
| 10116 | }; |
| 10117 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10118 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 10119 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10120 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 10121 | /* output mixer control */ |
| 10122 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10123 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10124 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10125 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10126 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10127 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10128 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10129 | { } |
| 10130 | }; |
| 10131 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10132 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 10133 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 10134 | .ops = &snd_hda_bind_sw, |
| 10135 | .values = { |
| 10136 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 10137 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 10138 | 0 |
| 10139 | }, |
| 10140 | }; |
| 10141 | |
| 10142 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 10143 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 10144 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 10145 | { } |
| 10146 | }; |
| 10147 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10148 | static struct hda_verb alc268_eapd_verbs[] = { |
| 10149 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10150 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10151 | { } |
| 10152 | }; |
| 10153 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10154 | /* Toshiba specific */ |
| 10155 | #define alc268_toshiba_automute alc262_hippo_automute |
| 10156 | |
| 10157 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 10158 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10159 | { } /* end */ |
| 10160 | }; |
| 10161 | |
| 10162 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10163 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 10164 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 10165 | .ops = &snd_hda_bind_vol, |
| 10166 | .values = { |
| 10167 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 10168 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 10169 | 0 |
| 10170 | }, |
| 10171 | }; |
| 10172 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10173 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10174 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 10175 | { |
| 10176 | struct alc_spec *spec = codec->spec; |
| 10177 | unsigned int mute; |
| 10178 | |
| 10179 | if (force || !spec->sense_updated) { |
| 10180 | unsigned int present; |
| 10181 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10182 | AC_VERB_GET_PIN_SENSE, 0); |
| 10183 | spec->jack_present = (present & 0x80000000) != 0; |
| 10184 | spec->sense_updated = 1; |
| 10185 | } |
| 10186 | if (spec->jack_present) |
| 10187 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 10188 | else /* unmute internal speaker if necessary */ |
| 10189 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 10190 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10191 | HDA_AMP_MUTE, mute); |
| 10192 | } |
| 10193 | |
| 10194 | |
| 10195 | /* bind hp and internal speaker mute (with plug check) */ |
| 10196 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10197 | struct snd_ctl_elem_value *ucontrol) |
| 10198 | { |
| 10199 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10200 | long *valp = ucontrol->value.integer.value; |
| 10201 | int change; |
| 10202 | |
| 10203 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10204 | HDA_AMP_MUTE, |
| 10205 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 10206 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10207 | HDA_AMP_MUTE, |
| 10208 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 10209 | if (change) |
| 10210 | alc268_acer_automute(codec, 0); |
| 10211 | return change; |
| 10212 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10213 | |
| 10214 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 10215 | /* output mixer control */ |
| 10216 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10217 | { |
| 10218 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10219 | .name = "Master Playback Switch", |
| 10220 | .info = snd_hda_mixer_amp_switch_info, |
| 10221 | .get = snd_hda_mixer_amp_switch_get, |
| 10222 | .put = alc268_acer_master_sw_put, |
| 10223 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10224 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10225 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10226 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10227 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10228 | { } |
| 10229 | }; |
| 10230 | |
| 10231 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10232 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 10233 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10236 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10237 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10238 | |
| 10239 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10240 | { } |
| 10241 | }; |
| 10242 | |
| 10243 | /* unsolicited event for HP jack sensing */ |
| 10244 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 10245 | unsigned int res) |
| 10246 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10247 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10248 | return; |
| 10249 | alc268_toshiba_automute(codec); |
| 10250 | } |
| 10251 | |
| 10252 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 10253 | unsigned int res) |
| 10254 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10255 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10256 | return; |
| 10257 | alc268_acer_automute(codec, 1); |
| 10258 | } |
| 10259 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10260 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 10261 | { |
| 10262 | alc268_acer_automute(codec, 1); |
| 10263 | } |
| 10264 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10265 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 10266 | /* output mixer control */ |
| 10267 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10268 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10269 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10270 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10271 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10272 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10273 | { } |
| 10274 | }; |
| 10275 | |
| 10276 | static struct hda_verb alc268_dell_verbs[] = { |
| 10277 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10278 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10279 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10280 | { } |
| 10281 | }; |
| 10282 | |
| 10283 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10284 | static void alc268_dell_automute(struct hda_codec *codec) |
| 10285 | { |
| 10286 | unsigned int present; |
| 10287 | unsigned int mute; |
| 10288 | |
| 10289 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 10290 | if (present & 0x80000000) |
| 10291 | mute = HDA_AMP_MUTE; |
| 10292 | else |
| 10293 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 10294 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10295 | HDA_AMP_MUTE, mute); |
| 10296 | } |
| 10297 | |
| 10298 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 10299 | unsigned int res) |
| 10300 | { |
| 10301 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10302 | return; |
| 10303 | alc268_dell_automute(codec); |
| 10304 | } |
| 10305 | |
| 10306 | #define alc268_dell_init_hook alc268_dell_automute |
| 10307 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10308 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 10309 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10310 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10311 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10312 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10313 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10314 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10315 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 10316 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10317 | { } |
| 10318 | }; |
| 10319 | |
| 10320 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 10321 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10322 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 10323 | { } |
| 10324 | }; |
| 10325 | |
| 10326 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 10327 | { |
| 10328 | unsigned int present; |
| 10329 | |
| 10330 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 10331 | & AC_PINSENSE_PRESENCE; |
| 10332 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10333 | present ? 0 : PIN_OUT); |
| 10334 | } |
| 10335 | |
| 10336 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 10337 | { |
| 10338 | unsigned int present; |
| 10339 | |
| 10340 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10341 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10342 | snd_hda_codec_write(codec, 0x23, 0, |
| 10343 | AC_VERB_SET_CONNECT_SEL, |
| 10344 | present ? 0x00 : 0x01); |
| 10345 | } |
| 10346 | |
| 10347 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 10348 | { |
| 10349 | alc267_quanta_il1_hp_automute(codec); |
| 10350 | alc267_quanta_il1_mic_automute(codec); |
| 10351 | } |
| 10352 | |
| 10353 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 10354 | unsigned int res) |
| 10355 | { |
| 10356 | switch (res >> 26) { |
| 10357 | case ALC880_HP_EVENT: |
| 10358 | alc267_quanta_il1_hp_automute(codec); |
| 10359 | break; |
| 10360 | case ALC880_MIC_EVENT: |
| 10361 | alc267_quanta_il1_mic_automute(codec); |
| 10362 | break; |
| 10363 | } |
| 10364 | } |
| 10365 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10366 | /* |
| 10367 | * generic initialization of ADC, input mixers and output mixers |
| 10368 | */ |
| 10369 | static struct hda_verb alc268_base_init_verbs[] = { |
| 10370 | /* Unmute DAC0-1 and set vol = 0 */ |
| 10371 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10372 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10373 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10374 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10375 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10376 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10377 | |
| 10378 | /* |
| 10379 | * Set up output mixers (0x0c - 0x0e) |
| 10380 | */ |
| 10381 | /* set vol=0 to output mixers */ |
| 10382 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10383 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10384 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10385 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10386 | |
| 10387 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10388 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10389 | |
| 10390 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10392 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10393 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10394 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10395 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10396 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10397 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10398 | |
| 10399 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10400 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10401 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10402 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10403 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10404 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10405 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10406 | |
| 10407 | /* set PCBEEP vol = 0, mute connections */ |
| 10408 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10409 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10410 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10411 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10412 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 10413 | |
| 10414 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10415 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10416 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10417 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10418 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10419 | { } |
| 10420 | }; |
| 10421 | |
| 10422 | /* |
| 10423 | * generic initialization of ADC, input mixers and output mixers |
| 10424 | */ |
| 10425 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 10426 | /* set output DAC */ |
| 10427 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10428 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10429 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10430 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10431 | |
| 10432 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10433 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10434 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10435 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10436 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10437 | |
| 10438 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10439 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10440 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10441 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10442 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10443 | |
| 10444 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10445 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10446 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10447 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10448 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10449 | /* set PCBEEP vol = 0, mute connections */ |
| 10450 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10451 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10452 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10453 | |
| 10454 | { } |
| 10455 | }; |
| 10456 | |
| 10457 | #define alc268_mux_enum_info alc_mux_enum_info |
| 10458 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10459 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10460 | |
| 10461 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 10462 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10463 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10464 | { |
| 10465 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10466 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10467 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10468 | */ |
| 10469 | /* .name = "Capture Source", */ |
| 10470 | .name = "Input Source", |
| 10471 | .count = 1, |
| 10472 | .info = alc268_mux_enum_info, |
| 10473 | .get = alc268_mux_enum_get, |
| 10474 | .put = alc268_mux_enum_put, |
| 10475 | }, |
| 10476 | { } /* end */ |
| 10477 | }; |
| 10478 | |
| 10479 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 10480 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10481 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10482 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10483 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10484 | { |
| 10485 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10486 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10487 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10488 | */ |
| 10489 | /* .name = "Capture Source", */ |
| 10490 | .name = "Input Source", |
| 10491 | .count = 2, |
| 10492 | .info = alc268_mux_enum_info, |
| 10493 | .get = alc268_mux_enum_get, |
| 10494 | .put = alc268_mux_enum_put, |
| 10495 | }, |
| 10496 | { } /* end */ |
| 10497 | }; |
| 10498 | |
| 10499 | static struct hda_input_mux alc268_capture_source = { |
| 10500 | .num_items = 4, |
| 10501 | .items = { |
| 10502 | { "Mic", 0x0 }, |
| 10503 | { "Front Mic", 0x1 }, |
| 10504 | { "Line", 0x2 }, |
| 10505 | { "CD", 0x3 }, |
| 10506 | }, |
| 10507 | }; |
| 10508 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10509 | static struct hda_input_mux alc268_acer_capture_source = { |
| 10510 | .num_items = 3, |
| 10511 | .items = { |
| 10512 | { "Mic", 0x0 }, |
| 10513 | { "Internal Mic", 0x6 }, |
| 10514 | { "Line", 0x2 }, |
| 10515 | }, |
| 10516 | }; |
| 10517 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10518 | #ifdef CONFIG_SND_DEBUG |
| 10519 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10520 | /* Volume widgets */ |
| 10521 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10522 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10523 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10524 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10525 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 10526 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 10527 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 10528 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 10529 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 10530 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 10531 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 10532 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 10533 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 10534 | /* The below appears problematic on some hardwares */ |
| 10535 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10536 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10537 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10538 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 10539 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 10540 | |
| 10541 | /* Modes for retasking pin widgets */ |
| 10542 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 10543 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 10544 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 10545 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 10546 | |
| 10547 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 10548 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 10549 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 10550 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 10551 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 10552 | |
| 10553 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 10554 | * The ALC268 does not have an SPDIF input. |
| 10555 | */ |
| 10556 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 10557 | |
| 10558 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 10559 | * this output to turn on an external amplifier. |
| 10560 | */ |
| 10561 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 10562 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 10563 | |
| 10564 | { } /* end */ |
| 10565 | }; |
| 10566 | #endif |
| 10567 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10568 | /* create input playback/capture controls for the given pin */ |
| 10569 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 10570 | const char *ctlname, int idx) |
| 10571 | { |
| 10572 | char name[32]; |
| 10573 | int err; |
| 10574 | |
| 10575 | sprintf(name, "%s Playback Volume", ctlname); |
| 10576 | if (nid == 0x14) { |
| 10577 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10578 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 10579 | HDA_OUTPUT)); |
| 10580 | if (err < 0) |
| 10581 | return err; |
| 10582 | } else if (nid == 0x15) { |
| 10583 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10584 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 10585 | HDA_OUTPUT)); |
| 10586 | if (err < 0) |
| 10587 | return err; |
| 10588 | } else |
| 10589 | return -1; |
| 10590 | sprintf(name, "%s Playback Switch", ctlname); |
| 10591 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10592 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 10593 | if (err < 0) |
| 10594 | return err; |
| 10595 | return 0; |
| 10596 | } |
| 10597 | |
| 10598 | /* add playback controls from the parsed DAC table */ |
| 10599 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10600 | const struct auto_pin_cfg *cfg) |
| 10601 | { |
| 10602 | hda_nid_t nid; |
| 10603 | int err; |
| 10604 | |
| 10605 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 10606 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10607 | spec->multiout.dac_nids[0] = 2; |
| 10608 | spec->multiout.dac_nids[1] = 3; |
| 10609 | |
| 10610 | nid = cfg->line_out_pins[0]; |
| 10611 | if (nid) |
| 10612 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 10613 | |
| 10614 | nid = cfg->speaker_pins[0]; |
| 10615 | if (nid == 0x1d) { |
| 10616 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10617 | "Speaker Playback Volume", |
| 10618 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10619 | if (err < 0) |
| 10620 | return err; |
| 10621 | } |
| 10622 | nid = cfg->hp_pins[0]; |
| 10623 | if (nid) |
| 10624 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 10625 | |
| 10626 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 10627 | if (nid == 0x16) { |
| 10628 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10629 | "Mono Playback Switch", |
| 10630 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 10631 | if (err < 0) |
| 10632 | return err; |
| 10633 | } |
| 10634 | return 0; |
| 10635 | } |
| 10636 | |
| 10637 | /* create playback/capture controls for input pins */ |
| 10638 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10639 | const struct auto_pin_cfg *cfg) |
| 10640 | { |
| 10641 | struct hda_input_mux *imux = &spec->private_imux; |
| 10642 | int i, idx1; |
| 10643 | |
| 10644 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10645 | switch(cfg->input_pins[i]) { |
| 10646 | case 0x18: |
| 10647 | idx1 = 0; /* Mic 1 */ |
| 10648 | break; |
| 10649 | case 0x19: |
| 10650 | idx1 = 1; /* Mic 2 */ |
| 10651 | break; |
| 10652 | case 0x1a: |
| 10653 | idx1 = 2; /* Line In */ |
| 10654 | break; |
| 10655 | case 0x1c: |
| 10656 | idx1 = 3; /* CD */ |
| 10657 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 10658 | case 0x12: |
| 10659 | case 0x13: |
| 10660 | idx1 = 6; /* digital mics */ |
| 10661 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10662 | default: |
| 10663 | continue; |
| 10664 | } |
| 10665 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 10666 | imux->items[imux->num_items].index = idx1; |
| 10667 | imux->num_items++; |
| 10668 | } |
| 10669 | return 0; |
| 10670 | } |
| 10671 | |
| 10672 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 10673 | { |
| 10674 | struct alc_spec *spec = codec->spec; |
| 10675 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10676 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10677 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10678 | unsigned int dac_vol1, dac_vol2; |
| 10679 | |
| 10680 | if (speaker_nid) { |
| 10681 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 10682 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 10683 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10684 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10685 | AMP_IN_UNMUTE(1)); |
| 10686 | snd_hda_codec_write(codec, 0x10, 0, |
| 10687 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10688 | AMP_IN_UNMUTE(1)); |
| 10689 | } else { |
| 10690 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10691 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10692 | snd_hda_codec_write(codec, 0x10, 0, |
| 10693 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10694 | } |
| 10695 | |
| 10696 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 10697 | if (line_nid == 0x14) |
| 10698 | dac_vol2 = AMP_OUT_ZERO; |
| 10699 | else if (line_nid == 0x15) |
| 10700 | dac_vol1 = AMP_OUT_ZERO; |
| 10701 | if (hp_nid == 0x14) |
| 10702 | dac_vol2 = AMP_OUT_ZERO; |
| 10703 | else if (hp_nid == 0x15) |
| 10704 | dac_vol1 = AMP_OUT_ZERO; |
| 10705 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10706 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10707 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10708 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10709 | |
| 10710 | snd_hda_codec_write(codec, 0x02, 0, |
| 10711 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10712 | snd_hda_codec_write(codec, 0x03, 0, |
| 10713 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10714 | } |
| 10715 | |
| 10716 | /* pcm configuration: identiacal with ALC880 */ |
| 10717 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10718 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10719 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10720 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10721 | |
| 10722 | /* |
| 10723 | * BIOS auto configuration |
| 10724 | */ |
| 10725 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10726 | { |
| 10727 | struct alc_spec *spec = codec->spec; |
| 10728 | int err; |
| 10729 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10730 | |
| 10731 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10732 | alc268_ignore); |
| 10733 | if (err < 0) |
| 10734 | return err; |
| 10735 | if (!spec->autocfg.line_outs) |
| 10736 | return 0; /* can't find valid BIOS pin config */ |
| 10737 | |
| 10738 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10739 | if (err < 0) |
| 10740 | return err; |
| 10741 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10742 | if (err < 0) |
| 10743 | return err; |
| 10744 | |
| 10745 | spec->multiout.max_channels = 2; |
| 10746 | |
| 10747 | /* digital only support output */ |
| 10748 | if (spec->autocfg.dig_out_pin) |
| 10749 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10750 | |
| 10751 | if (spec->kctl_alloc) |
| 10752 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10753 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10754 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 10755 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 10756 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10757 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10758 | spec->num_mux_defs = 1; |
| 10759 | spec->input_mux = &spec->private_imux; |
| 10760 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10761 | err = alc_auto_add_mic_boost(codec); |
| 10762 | if (err < 0) |
| 10763 | return err; |
| 10764 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10765 | return 1; |
| 10766 | } |
| 10767 | |
| 10768 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10769 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10770 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10771 | |
| 10772 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10773 | static void alc268_auto_init(struct hda_codec *codec) |
| 10774 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10775 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10776 | alc268_auto_init_multi_out(codec); |
| 10777 | alc268_auto_init_hp_out(codec); |
| 10778 | alc268_auto_init_mono_speaker_out(codec); |
| 10779 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10780 | if (spec->unsol_event) |
| 10781 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10782 | } |
| 10783 | |
| 10784 | /* |
| 10785 | * configuration and preset |
| 10786 | */ |
| 10787 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10788 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10789 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10790 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10791 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10792 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10793 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10794 | #ifdef CONFIG_SND_DEBUG |
| 10795 | [ALC268_TEST] = "test", |
| 10796 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10797 | [ALC268_AUTO] = "auto", |
| 10798 | }; |
| 10799 | |
| 10800 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 10801 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10802 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10803 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10804 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10805 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10806 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10807 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10808 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10809 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10810 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 10811 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10812 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10813 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10814 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10815 | {} |
| 10816 | }; |
| 10817 | |
| 10818 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10819 | [ALC267_QUANTA_IL1] = { |
| 10820 | .mixers = { alc267_quanta_il1_mixer }, |
| 10821 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10822 | alc267_quanta_il1_verbs }, |
| 10823 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10824 | .dac_nids = alc268_dac_nids, |
| 10825 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10826 | .adc_nids = alc268_adc_nids_alt, |
| 10827 | .hp_nid = 0x03, |
| 10828 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10829 | .channel_mode = alc268_modes, |
| 10830 | .input_mux = &alc268_capture_source, |
| 10831 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 10832 | .init_hook = alc267_quanta_il1_automute, |
| 10833 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10834 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10835 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10836 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10837 | .init_verbs = { alc268_base_init_verbs }, |
| 10838 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10839 | .dac_nids = alc268_dac_nids, |
| 10840 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10841 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10842 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10843 | .hp_nid = 0x03, |
| 10844 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10845 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10846 | .channel_mode = alc268_modes, |
| 10847 | .input_mux = &alc268_capture_source, |
| 10848 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10849 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10850 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10851 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10852 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10853 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10854 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10855 | .dac_nids = alc268_dac_nids, |
| 10856 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10857 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10858 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10859 | .hp_nid = 0x03, |
| 10860 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10861 | .channel_mode = alc268_modes, |
| 10862 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10863 | .unsol_event = alc268_toshiba_unsol_event, |
| 10864 | .init_hook = alc268_toshiba_automute, |
| 10865 | }, |
| 10866 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10867 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 10868 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10869 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10870 | alc268_acer_verbs }, |
| 10871 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10872 | .dac_nids = alc268_dac_nids, |
| 10873 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10874 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10875 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10876 | .hp_nid = 0x02, |
| 10877 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10878 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10879 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10880 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10881 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10882 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10883 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10884 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10885 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10886 | alc268_dell_verbs }, |
| 10887 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10888 | .dac_nids = alc268_dac_nids, |
| 10889 | .hp_nid = 0x02, |
| 10890 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10891 | .channel_mode = alc268_modes, |
| 10892 | .unsol_event = alc268_dell_unsol_event, |
| 10893 | .init_hook = alc268_dell_init_hook, |
| 10894 | .input_mux = &alc268_capture_source, |
| 10895 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10896 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10897 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10898 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10899 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10900 | alc268_toshiba_verbs }, |
| 10901 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10902 | .dac_nids = alc268_dac_nids, |
| 10903 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10904 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10905 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10906 | .hp_nid = 0x03, |
| 10907 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10908 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10909 | .channel_mode = alc268_modes, |
| 10910 | .input_mux = &alc268_capture_source, |
| 10911 | .unsol_event = alc268_toshiba_unsol_event, |
| 10912 | .init_hook = alc268_toshiba_automute |
| 10913 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10914 | #ifdef CONFIG_SND_DEBUG |
| 10915 | [ALC268_TEST] = { |
| 10916 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10917 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10918 | alc268_volume_init_verbs }, |
| 10919 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10920 | .dac_nids = alc268_dac_nids, |
| 10921 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10922 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10923 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10924 | .hp_nid = 0x03, |
| 10925 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10926 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10927 | .channel_mode = alc268_modes, |
| 10928 | .input_mux = &alc268_capture_source, |
| 10929 | }, |
| 10930 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10931 | }; |
| 10932 | |
| 10933 | static int patch_alc268(struct hda_codec *codec) |
| 10934 | { |
| 10935 | struct alc_spec *spec; |
| 10936 | int board_config; |
| 10937 | int err; |
| 10938 | |
| 10939 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10940 | if (spec == NULL) |
| 10941 | return -ENOMEM; |
| 10942 | |
| 10943 | codec->spec = spec; |
| 10944 | |
| 10945 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10946 | alc268_models, |
| 10947 | alc268_cfg_tbl); |
| 10948 | |
| 10949 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10950 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10951 | "trying auto-probe from BIOS...\n"); |
| 10952 | board_config = ALC268_AUTO; |
| 10953 | } |
| 10954 | |
| 10955 | if (board_config == ALC268_AUTO) { |
| 10956 | /* automatic parse from the BIOS config */ |
| 10957 | err = alc268_parse_auto_config(codec); |
| 10958 | if (err < 0) { |
| 10959 | alc_free(codec); |
| 10960 | return err; |
| 10961 | } else if (!err) { |
| 10962 | printk(KERN_INFO |
| 10963 | "hda_codec: Cannot set up configuration " |
| 10964 | "from BIOS. Using base mode...\n"); |
| 10965 | board_config = ALC268_3ST; |
| 10966 | } |
| 10967 | } |
| 10968 | |
| 10969 | if (board_config != ALC268_AUTO) |
| 10970 | setup_preset(spec, &alc268_presets[board_config]); |
| 10971 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10972 | if (codec->vendor_id == 0x10ec0267) { |
| 10973 | spec->stream_name_analog = "ALC267 Analog"; |
| 10974 | spec->stream_name_digital = "ALC267 Digital"; |
| 10975 | } else { |
| 10976 | spec->stream_name_analog = "ALC268 Analog"; |
| 10977 | spec->stream_name_digital = "ALC268 Digital"; |
| 10978 | } |
| 10979 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10980 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10981 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10982 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10983 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10984 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10985 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10986 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 10987 | /* override the amp caps for beep generator */ |
| 10988 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 10989 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 10990 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 10991 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 10992 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 10993 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10994 | if (!spec->adc_nids && spec->input_mux) { |
| 10995 | /* check whether NID 0x07 is valid */ |
| 10996 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10997 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10998 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10999 | /* get type */ |
| 11000 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 11001 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11002 | spec->adc_nids = alc268_adc_nids_alt; |
| 11003 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 11004 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11005 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11006 | spec->num_mixers++; |
| 11007 | } else { |
| 11008 | spec->adc_nids = alc268_adc_nids; |
| 11009 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 11010 | spec->mixers[spec->num_mixers] = |
| 11011 | alc268_capture_mixer; |
| 11012 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11013 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11014 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11015 | /* set default input source */ |
| 11016 | for (i = 0; i < spec->num_adc_nids; i++) |
| 11017 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 11018 | 0, AC_VERB_SET_CONNECT_SEL, |
| 11019 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11020 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11021 | |
| 11022 | spec->vmaster_nid = 0x02; |
| 11023 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11024 | codec->patch_ops = alc_patch_ops; |
| 11025 | if (board_config == ALC268_AUTO) |
| 11026 | spec->init_hook = alc268_auto_init; |
| 11027 | |
| 11028 | return 0; |
| 11029 | } |
| 11030 | |
| 11031 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11032 | * ALC269 channel source setting (2 channel) |
| 11033 | */ |
| 11034 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 11035 | |
| 11036 | #define alc269_dac_nids alc260_dac_nids |
| 11037 | |
| 11038 | static hda_nid_t alc269_adc_nids[1] = { |
| 11039 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11040 | 0x08, |
| 11041 | }; |
| 11042 | |
| 11043 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 11044 | .num_items = 2, |
| 11045 | .items = { |
| 11046 | { "i-Mic", 0x5 }, |
| 11047 | { "e-Mic", 0x0 }, |
| 11048 | }, |
| 11049 | }; |
| 11050 | |
| 11051 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 11052 | .num_items = 2, |
| 11053 | .items = { |
| 11054 | { "i-Mic", 0x1 }, |
| 11055 | { "e-Mic", 0x0 }, |
| 11056 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11057 | }; |
| 11058 | |
| 11059 | #define alc269_modes alc260_modes |
| 11060 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 11061 | |
| 11062 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 11063 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11064 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11065 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11066 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11067 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11068 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11069 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11070 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11071 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11072 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11073 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11074 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 11075 | { } /* end */ |
| 11076 | }; |
| 11077 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11078 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 11079 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 11080 | .ops = &snd_hda_bind_vol, |
| 11081 | .values = { |
| 11082 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11083 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11084 | 0 |
| 11085 | }, |
| 11086 | }; |
| 11087 | |
| 11088 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 11089 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11090 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 11091 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11092 | { } /* end */ |
| 11093 | }; |
| 11094 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11095 | /* capture mixer elements */ |
| 11096 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11097 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11098 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11099 | { |
| 11100 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11101 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11102 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11103 | */ |
| 11104 | /* .name = "Capture Source", */ |
| 11105 | .name = "Input Source", |
| 11106 | .count = 1, |
| 11107 | .info = alc_mux_enum_info, |
| 11108 | .get = alc_mux_enum_get, |
| 11109 | .put = alc_mux_enum_put, |
| 11110 | }, |
| 11111 | { } /* end */ |
| 11112 | }; |
| 11113 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11114 | /* capture mixer elements */ |
| 11115 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 11116 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11117 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11118 | { } /* end */ |
| 11119 | }; |
| 11120 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11121 | /* |
| 11122 | * generic initialization of ADC, input mixers and output mixers |
| 11123 | */ |
| 11124 | static struct hda_verb alc269_init_verbs[] = { |
| 11125 | /* |
| 11126 | * Unmute ADC0 and set the default input to mic-in |
| 11127 | */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11128 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11129 | |
| 11130 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 11131 | * analog-loopback mixer widget |
| 11132 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11133 | * front panel mic (mic 2) |
| 11134 | */ |
| 11135 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 11136 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11137 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11138 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11139 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11140 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11141 | |
| 11142 | /* |
| 11143 | * Set up output mixers (0x0c - 0x0e) |
| 11144 | */ |
| 11145 | /* set vol=0 to output mixers */ |
| 11146 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11147 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11148 | |
| 11149 | /* set up input amps for analog loopback */ |
| 11150 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11151 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11152 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11153 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11154 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11155 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11156 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11157 | |
| 11158 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11159 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11160 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11161 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11162 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11163 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11164 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11165 | |
| 11166 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11167 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11168 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11169 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11170 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11171 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11172 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11173 | |
| 11174 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11175 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11176 | |
| 11177 | /* FIXME: use matrix-type input source selection */ |
| 11178 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 11179 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11180 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11181 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11182 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11183 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11184 | |
| 11185 | /* set EAPD */ |
| 11186 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11187 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11188 | { } |
| 11189 | }; |
| 11190 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11191 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 11192 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11193 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 11194 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11195 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 11196 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11197 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11198 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11199 | {} |
| 11200 | }; |
| 11201 | |
| 11202 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 11203 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11204 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11205 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11206 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 11207 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11208 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11209 | {} |
| 11210 | }; |
| 11211 | |
| 11212 | /* toggle speaker-output according to the hp-jack state */ |
| 11213 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 11214 | { |
| 11215 | unsigned int present; |
| 11216 | unsigned int bits; |
| 11217 | |
| 11218 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11219 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11220 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11221 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11222 | AMP_IN_MUTE(0), bits); |
| 11223 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11224 | AMP_IN_MUTE(0), bits); |
| 11225 | } |
| 11226 | |
| 11227 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 11228 | { |
| 11229 | unsigned int present; |
| 11230 | |
| 11231 | present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11232 | & AC_PINSENSE_PRESENCE; |
| 11233 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11234 | present ? 0 : 5); |
| 11235 | } |
| 11236 | |
| 11237 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 11238 | { |
| 11239 | unsigned int present; |
| 11240 | |
| 11241 | present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11242 | & AC_PINSENSE_PRESENCE; |
| 11243 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11244 | present ? AMP_IN_UNMUTE(0) : AMP_IN_MUTE(0)); |
| 11245 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11246 | present ? AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1)); |
| 11247 | } |
| 11248 | |
| 11249 | /* unsolicited event for HP jack sensing */ |
| 11250 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 11251 | unsigned int res) |
| 11252 | { |
| 11253 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11254 | alc269_speaker_automute(codec); |
| 11255 | |
| 11256 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11257 | alc269_eeepc_dmic_automute(codec); |
| 11258 | } |
| 11259 | |
| 11260 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 11261 | { |
| 11262 | alc269_speaker_automute(codec); |
| 11263 | alc269_eeepc_dmic_automute(codec); |
| 11264 | } |
| 11265 | |
| 11266 | /* unsolicited event for HP jack sensing */ |
| 11267 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 11268 | unsigned int res) |
| 11269 | { |
| 11270 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11271 | alc269_speaker_automute(codec); |
| 11272 | |
| 11273 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11274 | alc269_eeepc_amic_automute(codec); |
| 11275 | } |
| 11276 | |
| 11277 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 11278 | { |
| 11279 | alc269_speaker_automute(codec); |
| 11280 | alc269_eeepc_amic_automute(codec); |
| 11281 | } |
| 11282 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11283 | /* add playback controls from the parsed DAC table */ |
| 11284 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11285 | const struct auto_pin_cfg *cfg) |
| 11286 | { |
| 11287 | hda_nid_t nid; |
| 11288 | int err; |
| 11289 | |
| 11290 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11291 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11292 | spec->multiout.dac_nids[0] = 2; |
| 11293 | |
| 11294 | nid = cfg->line_out_pins[0]; |
| 11295 | if (nid) { |
| 11296 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11297 | "Front Playback Volume", |
| 11298 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 11299 | if (err < 0) |
| 11300 | return err; |
| 11301 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11302 | "Front Playback Switch", |
| 11303 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11304 | if (err < 0) |
| 11305 | return err; |
| 11306 | } |
| 11307 | |
| 11308 | nid = cfg->speaker_pins[0]; |
| 11309 | if (nid) { |
| 11310 | if (!cfg->line_out_pins[0]) { |
| 11311 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11312 | "Speaker Playback Volume", |
| 11313 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 11314 | HDA_OUTPUT)); |
| 11315 | if (err < 0) |
| 11316 | return err; |
| 11317 | } |
| 11318 | if (nid == 0x16) { |
| 11319 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11320 | "Speaker Playback Switch", |
| 11321 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11322 | HDA_OUTPUT)); |
| 11323 | if (err < 0) |
| 11324 | return err; |
| 11325 | } else { |
| 11326 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11327 | "Speaker Playback Switch", |
| 11328 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11329 | HDA_OUTPUT)); |
| 11330 | if (err < 0) |
| 11331 | return err; |
| 11332 | } |
| 11333 | } |
| 11334 | nid = cfg->hp_pins[0]; |
| 11335 | if (nid) { |
| 11336 | /* spec->multiout.hp_nid = 2; */ |
| 11337 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 11338 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11339 | "Headphone Playback Volume", |
| 11340 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 11341 | HDA_OUTPUT)); |
| 11342 | if (err < 0) |
| 11343 | return err; |
| 11344 | } |
| 11345 | if (nid == 0x16) { |
| 11346 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11347 | "Headphone Playback Switch", |
| 11348 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11349 | HDA_OUTPUT)); |
| 11350 | if (err < 0) |
| 11351 | return err; |
| 11352 | } else { |
| 11353 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11354 | "Headphone Playback Switch", |
| 11355 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11356 | HDA_OUTPUT)); |
| 11357 | if (err < 0) |
| 11358 | return err; |
| 11359 | } |
| 11360 | } |
| 11361 | return 0; |
| 11362 | } |
| 11363 | |
| 11364 | #define alc269_auto_create_analog_input_ctls \ |
| 11365 | alc880_auto_create_analog_input_ctls |
| 11366 | |
| 11367 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11368 | #define alc269_loopbacks alc880_loopbacks |
| 11369 | #endif |
| 11370 | |
| 11371 | /* pcm configuration: identiacal with ALC880 */ |
| 11372 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 11373 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 11374 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 11375 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 11376 | |
| 11377 | /* |
| 11378 | * BIOS auto configuration |
| 11379 | */ |
| 11380 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 11381 | { |
| 11382 | struct alc_spec *spec = codec->spec; |
| 11383 | int err; |
| 11384 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 11385 | |
| 11386 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11387 | alc269_ignore); |
| 11388 | if (err < 0) |
| 11389 | return err; |
| 11390 | |
| 11391 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11392 | if (err < 0) |
| 11393 | return err; |
| 11394 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11395 | if (err < 0) |
| 11396 | return err; |
| 11397 | |
| 11398 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11399 | |
| 11400 | if (spec->autocfg.dig_out_pin) |
| 11401 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 11402 | |
| 11403 | if (spec->kctl_alloc) |
| 11404 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11405 | |
| 11406 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 11407 | spec->num_mux_defs = 1; |
| 11408 | spec->input_mux = &spec->private_imux; |
| 11409 | |
| 11410 | err = alc_auto_add_mic_boost(codec); |
| 11411 | if (err < 0) |
| 11412 | return err; |
| 11413 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11414 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 11415 | spec->num_mixers++; |
| 11416 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11417 | return 1; |
| 11418 | } |
| 11419 | |
| 11420 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 11421 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 11422 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 11423 | |
| 11424 | |
| 11425 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11426 | static void alc269_auto_init(struct hda_codec *codec) |
| 11427 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11428 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11429 | alc269_auto_init_multi_out(codec); |
| 11430 | alc269_auto_init_hp_out(codec); |
| 11431 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11432 | if (spec->unsol_event) |
| 11433 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11434 | } |
| 11435 | |
| 11436 | /* |
| 11437 | * configuration and preset |
| 11438 | */ |
| 11439 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 11440 | [ALC269_BASIC] = "basic", |
| 11441 | }; |
| 11442 | |
| 11443 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11444 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 11445 | ALC269_ASUS_EEEPC_P703), |
| 11446 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 11447 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11448 | {} |
| 11449 | }; |
| 11450 | |
| 11451 | static struct alc_config_preset alc269_presets[] = { |
| 11452 | [ALC269_BASIC] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11453 | .mixers = { alc269_base_mixer, alc269_capture_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11454 | .init_verbs = { alc269_init_verbs }, |
| 11455 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11456 | .dac_nids = alc269_dac_nids, |
| 11457 | .hp_nid = 0x03, |
| 11458 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11459 | .channel_mode = alc269_modes, |
| 11460 | .input_mux = &alc269_capture_source, |
| 11461 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11462 | [ALC269_ASUS_EEEPC_P703] = { |
| 11463 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, |
| 11464 | .init_verbs = { alc269_init_verbs, |
| 11465 | alc269_eeepc_amic_init_verbs }, |
| 11466 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11467 | .dac_nids = alc269_dac_nids, |
| 11468 | .hp_nid = 0x03, |
| 11469 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11470 | .channel_mode = alc269_modes, |
| 11471 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 11472 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 11473 | .init_hook = alc269_eeepc_amic_inithook, |
| 11474 | }, |
| 11475 | [ALC269_ASUS_EEEPC_P901] = { |
| 11476 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer}, |
| 11477 | .init_verbs = { alc269_init_verbs, |
| 11478 | alc269_eeepc_dmic_init_verbs }, |
| 11479 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11480 | .dac_nids = alc269_dac_nids, |
| 11481 | .hp_nid = 0x03, |
| 11482 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11483 | .channel_mode = alc269_modes, |
| 11484 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 11485 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 11486 | .init_hook = alc269_eeepc_dmic_inithook, |
| 11487 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11488 | }; |
| 11489 | |
| 11490 | static int patch_alc269(struct hda_codec *codec) |
| 11491 | { |
| 11492 | struct alc_spec *spec; |
| 11493 | int board_config; |
| 11494 | int err; |
| 11495 | |
| 11496 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11497 | if (spec == NULL) |
| 11498 | return -ENOMEM; |
| 11499 | |
| 11500 | codec->spec = spec; |
| 11501 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11502 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 11503 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11504 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 11505 | alc269_models, |
| 11506 | alc269_cfg_tbl); |
| 11507 | |
| 11508 | if (board_config < 0) { |
| 11509 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 11510 | "trying auto-probe from BIOS...\n"); |
| 11511 | board_config = ALC269_AUTO; |
| 11512 | } |
| 11513 | |
| 11514 | if (board_config == ALC269_AUTO) { |
| 11515 | /* automatic parse from the BIOS config */ |
| 11516 | err = alc269_parse_auto_config(codec); |
| 11517 | if (err < 0) { |
| 11518 | alc_free(codec); |
| 11519 | return err; |
| 11520 | } else if (!err) { |
| 11521 | printk(KERN_INFO |
| 11522 | "hda_codec: Cannot set up configuration " |
| 11523 | "from BIOS. Using base mode...\n"); |
| 11524 | board_config = ALC269_BASIC; |
| 11525 | } |
| 11526 | } |
| 11527 | |
| 11528 | if (board_config != ALC269_AUTO) |
| 11529 | setup_preset(spec, &alc269_presets[board_config]); |
| 11530 | |
| 11531 | spec->stream_name_analog = "ALC269 Analog"; |
| 11532 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 11533 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 11534 | |
| 11535 | spec->stream_name_digital = "ALC269 Digital"; |
| 11536 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 11537 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 11538 | |
| 11539 | spec->adc_nids = alc269_adc_nids; |
| 11540 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11541 | |
| 11542 | codec->patch_ops = alc_patch_ops; |
| 11543 | if (board_config == ALC269_AUTO) |
| 11544 | spec->init_hook = alc269_auto_init; |
| 11545 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11546 | if (!spec->loopback.amplist) |
| 11547 | spec->loopback.amplist = alc269_loopbacks; |
| 11548 | #endif |
| 11549 | |
| 11550 | return 0; |
| 11551 | } |
| 11552 | |
| 11553 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11554 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 11555 | */ |
| 11556 | |
| 11557 | /* |
| 11558 | * set the path ways for 2 channel output |
| 11559 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 11560 | */ |
| 11561 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 11562 | /* set pin widget 1Ah (line in) for input */ |
| 11563 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11564 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11565 | * the vref |
| 11566 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11567 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11568 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11569 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11570 | #if 0 |
| 11571 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11572 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11573 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11574 | { } /* end */ |
| 11575 | }; |
| 11576 | /* |
| 11577 | * 6ch mode |
| 11578 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 11579 | */ |
| 11580 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 11581 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11582 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11583 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11584 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11585 | |
| 11586 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11587 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11588 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11589 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11590 | #if 0 |
| 11591 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11592 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11593 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11594 | { } /* end */ |
| 11595 | }; |
| 11596 | |
| 11597 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 11598 | { 2, alc861_threestack_ch2_init }, |
| 11599 | { 6, alc861_threestack_ch6_init }, |
| 11600 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11601 | /* Set mic1 as input and unmute the mixer */ |
| 11602 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 11603 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11604 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11605 | { } /* end */ |
| 11606 | }; |
| 11607 | /* Set mic1 as output and mute mixer */ |
| 11608 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 11609 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11610 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11611 | { } /* end */ |
| 11612 | }; |
| 11613 | |
| 11614 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 11615 | { 2, alc861_uniwill_m31_ch2_init }, |
| 11616 | { 4, alc861_uniwill_m31_ch4_init }, |
| 11617 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11618 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11619 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 11620 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 11621 | /* set pin widget 1Ah (line in) for input */ |
| 11622 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11623 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11624 | * the vref |
| 11625 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11626 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11627 | |
| 11628 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11629 | #if 0 |
| 11630 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11631 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11632 | #endif |
| 11633 | { } /* end */ |
| 11634 | }; |
| 11635 | /* Set mic1 nad line-in as output and mute mixer */ |
| 11636 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 11637 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11638 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11639 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11640 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11641 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11642 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11643 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11644 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11645 | |
| 11646 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11647 | #if 0 |
| 11648 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11649 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11650 | #endif |
| 11651 | { } /* end */ |
| 11652 | }; |
| 11653 | |
| 11654 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 11655 | { 2, alc861_asus_ch2_init }, |
| 11656 | { 6, alc861_asus_ch6_init }, |
| 11657 | }; |
| 11658 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11659 | /* patch-ALC861 */ |
| 11660 | |
| 11661 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 11662 | /* output mixer control */ |
| 11663 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11664 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11665 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11666 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11667 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11668 | |
| 11669 | /*Input mixer control */ |
| 11670 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11671 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11672 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11673 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11674 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11675 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11676 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11677 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11678 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11679 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11680 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11681 | /* Capture mixer control */ |
| 11682 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11683 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11684 | { |
| 11685 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11686 | .name = "Capture Source", |
| 11687 | .count = 1, |
| 11688 | .info = alc_mux_enum_info, |
| 11689 | .get = alc_mux_enum_get, |
| 11690 | .put = alc_mux_enum_put, |
| 11691 | }, |
| 11692 | { } /* end */ |
| 11693 | }; |
| 11694 | |
| 11695 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 11696 | /* output mixer control */ |
| 11697 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11698 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11699 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11700 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11701 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11702 | |
| 11703 | /* Input mixer control */ |
| 11704 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11705 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11706 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11707 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11708 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11709 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11710 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11711 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11712 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11713 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11714 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11715 | /* Capture mixer control */ |
| 11716 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11717 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11718 | { |
| 11719 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11720 | .name = "Capture Source", |
| 11721 | .count = 1, |
| 11722 | .info = alc_mux_enum_info, |
| 11723 | .get = alc_mux_enum_get, |
| 11724 | .put = alc_mux_enum_put, |
| 11725 | }, |
| 11726 | { |
| 11727 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11728 | .name = "Channel Mode", |
| 11729 | .info = alc_ch_mode_info, |
| 11730 | .get = alc_ch_mode_get, |
| 11731 | .put = alc_ch_mode_put, |
| 11732 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 11733 | }, |
| 11734 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11735 | }; |
| 11736 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11737 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11738 | /* output mixer control */ |
| 11739 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11740 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11741 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11742 | |
| 11743 | /*Capture mixer control */ |
| 11744 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11745 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11746 | { |
| 11747 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11748 | .name = "Capture Source", |
| 11749 | .count = 1, |
| 11750 | .info = alc_mux_enum_info, |
| 11751 | .get = alc_mux_enum_get, |
| 11752 | .put = alc_mux_enum_put, |
| 11753 | }, |
| 11754 | |
| 11755 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11756 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11757 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11758 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 11759 | /* output mixer control */ |
| 11760 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11761 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11762 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11763 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11764 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11765 | |
| 11766 | /* Input mixer control */ |
| 11767 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11768 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11769 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11770 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11771 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11772 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11773 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11774 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11775 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11776 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11777 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11778 | /* Capture mixer control */ |
| 11779 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11780 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11781 | { |
| 11782 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11783 | .name = "Capture Source", |
| 11784 | .count = 1, |
| 11785 | .info = alc_mux_enum_info, |
| 11786 | .get = alc_mux_enum_get, |
| 11787 | .put = alc_mux_enum_put, |
| 11788 | }, |
| 11789 | { |
| 11790 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11791 | .name = "Channel Mode", |
| 11792 | .info = alc_ch_mode_info, |
| 11793 | .get = alc_ch_mode_get, |
| 11794 | .put = alc_ch_mode_put, |
| 11795 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11796 | }, |
| 11797 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11798 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11799 | |
| 11800 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 11801 | /* output mixer control */ |
| 11802 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11803 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11804 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11805 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11806 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11807 | |
| 11808 | /* Input mixer control */ |
| 11809 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11810 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11811 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11812 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11813 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11814 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11815 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11816 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11817 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11818 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 11819 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11820 | /* Capture mixer control */ |
| 11821 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11822 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11823 | { |
| 11824 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11825 | .name = "Capture Source", |
| 11826 | .count = 1, |
| 11827 | .info = alc_mux_enum_info, |
| 11828 | .get = alc_mux_enum_get, |
| 11829 | .put = alc_mux_enum_put, |
| 11830 | }, |
| 11831 | { |
| 11832 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11833 | .name = "Channel Mode", |
| 11834 | .info = alc_ch_mode_info, |
| 11835 | .get = alc_ch_mode_get, |
| 11836 | .put = alc_ch_mode_put, |
| 11837 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 11838 | }, |
| 11839 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11840 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11841 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11842 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11843 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11844 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11845 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11846 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11847 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11848 | { } |
| 11849 | }; |
| 11850 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11851 | /* |
| 11852 | * generic initialization of ADC, input mixers and output mixers |
| 11853 | */ |
| 11854 | static struct hda_verb alc861_base_init_verbs[] = { |
| 11855 | /* |
| 11856 | * Unmute ADC0 and set the default input to mic-in |
| 11857 | */ |
| 11858 | /* port-A for surround (rear panel) */ |
| 11859 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11860 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11861 | /* port-B for mic-in (rear panel) with vref */ |
| 11862 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11863 | /* port-C for line-in (rear panel) */ |
| 11864 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11865 | /* port-D for Front */ |
| 11866 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11867 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11868 | /* port-E for HP out (front panel) */ |
| 11869 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11870 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11871 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11872 | /* port-F for mic-in (front panel) with vref */ |
| 11873 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11874 | /* port-G for CLFE (rear panel) */ |
| 11875 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11876 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11877 | /* port-H for side (rear panel) */ |
| 11878 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11879 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11880 | /* CD-in */ |
| 11881 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11882 | /* route front mic to ADC1*/ |
| 11883 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11884 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11885 | |
| 11886 | /* Unmute DAC0~3 & spdif out*/ |
| 11887 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11888 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11889 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11890 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11891 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11892 | |
| 11893 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11894 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11895 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11896 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11897 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11898 | |
| 11899 | /* Unmute Stereo Mixer 15 */ |
| 11900 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11901 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11902 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11903 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11904 | |
| 11905 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11906 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11907 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11908 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11909 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11910 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11911 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11912 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11913 | /* hp used DAC 3 (Front) */ |
| 11914 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11915 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11916 | |
| 11917 | { } |
| 11918 | }; |
| 11919 | |
| 11920 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 11921 | /* |
| 11922 | * Unmute ADC0 and set the default input to mic-in |
| 11923 | */ |
| 11924 | /* port-A for surround (rear panel) */ |
| 11925 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11926 | /* port-B for mic-in (rear panel) with vref */ |
| 11927 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11928 | /* port-C for line-in (rear panel) */ |
| 11929 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11930 | /* port-D for Front */ |
| 11931 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11932 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11933 | /* port-E for HP out (front panel) */ |
| 11934 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11935 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11936 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11937 | /* port-F for mic-in (front panel) with vref */ |
| 11938 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11939 | /* port-G for CLFE (rear panel) */ |
| 11940 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11941 | /* port-H for side (rear panel) */ |
| 11942 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11943 | /* CD-in */ |
| 11944 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11945 | /* route front mic to ADC1*/ |
| 11946 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11947 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11948 | /* Unmute DAC0~3 & spdif out*/ |
| 11949 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11950 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11951 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11952 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11953 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11954 | |
| 11955 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11956 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11957 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11958 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11959 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11960 | |
| 11961 | /* Unmute Stereo Mixer 15 */ |
| 11962 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11963 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11964 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11965 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11966 | |
| 11967 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11968 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11969 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11970 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11971 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11972 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11973 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11974 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11975 | /* hp used DAC 3 (Front) */ |
| 11976 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11977 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11978 | { } |
| 11979 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11980 | |
| 11981 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11982 | /* |
| 11983 | * Unmute ADC0 and set the default input to mic-in |
| 11984 | */ |
| 11985 | /* port-A for surround (rear panel) */ |
| 11986 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11987 | /* port-B for mic-in (rear panel) with vref */ |
| 11988 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11989 | /* port-C for line-in (rear panel) */ |
| 11990 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11991 | /* port-D for Front */ |
| 11992 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11993 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11994 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11995 | /* this has to be set to VREF80 */ |
| 11996 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11997 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11998 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11999 | /* port-F for mic-in (front panel) with vref */ |
| 12000 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12001 | /* port-G for CLFE (rear panel) */ |
| 12002 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12003 | /* port-H for side (rear panel) */ |
| 12004 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12005 | /* CD-in */ |
| 12006 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12007 | /* route front mic to ADC1*/ |
| 12008 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12009 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12010 | /* Unmute DAC0~3 & spdif out*/ |
| 12011 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12012 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12013 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12014 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12015 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12016 | |
| 12017 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12018 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12019 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12020 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12021 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12022 | |
| 12023 | /* Unmute Stereo Mixer 15 */ |
| 12024 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12025 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12026 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12028 | |
| 12029 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12030 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12031 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12032 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12033 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12034 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12035 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12036 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12037 | /* hp used DAC 3 (Front) */ |
| 12038 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12039 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12040 | { } |
| 12041 | }; |
| 12042 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12043 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 12044 | /* |
| 12045 | * Unmute ADC0 and set the default input to mic-in |
| 12046 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12047 | /* port-A for surround (rear panel) |
| 12048 | * according to codec#0 this is the HP jack |
| 12049 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12050 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 12051 | /* route front PCM to HP */ |
| 12052 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12053 | /* port-B for mic-in (rear panel) with vref */ |
| 12054 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12055 | /* port-C for line-in (rear panel) */ |
| 12056 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12057 | /* port-D for Front */ |
| 12058 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12059 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12060 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12061 | /* this has to be set to VREF80 */ |
| 12062 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12063 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12064 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12065 | /* port-F for mic-in (front panel) with vref */ |
| 12066 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12067 | /* port-G for CLFE (rear panel) */ |
| 12068 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12069 | /* port-H for side (rear panel) */ |
| 12070 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12071 | /* CD-in */ |
| 12072 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12073 | /* route front mic to ADC1*/ |
| 12074 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12075 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12076 | /* Unmute DAC0~3 & spdif out*/ |
| 12077 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12078 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12079 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12080 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12081 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12082 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12083 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12084 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12085 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12086 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12087 | |
| 12088 | /* Unmute Stereo Mixer 15 */ |
| 12089 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12090 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12091 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12092 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12093 | |
| 12094 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12095 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12096 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12097 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12098 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12099 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12100 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12101 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12102 | /* hp used DAC 3 (Front) */ |
| 12103 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12104 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12105 | { } |
| 12106 | }; |
| 12107 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12108 | /* additional init verbs for ASUS laptops */ |
| 12109 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 12110 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 12111 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 12112 | { } |
| 12113 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12114 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12115 | /* |
| 12116 | * generic initialization of ADC, input mixers and output mixers |
| 12117 | */ |
| 12118 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 12119 | /* |
| 12120 | * Unmute ADC0 and set the default input to mic-in |
| 12121 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12122 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12123 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12124 | |
| 12125 | /* Unmute DAC0~3 & spdif out*/ |
| 12126 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12127 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12128 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12129 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12131 | |
| 12132 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12133 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12134 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12135 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12136 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12137 | |
| 12138 | /* Unmute Stereo Mixer 15 */ |
| 12139 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12140 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12141 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12142 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 12143 | |
| 12144 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12145 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12146 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12147 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12148 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12149 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12150 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12151 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12152 | |
| 12153 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12154 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12155 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12156 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12157 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12158 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12159 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12160 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12161 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12162 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12163 | |
| 12164 | { } |
| 12165 | }; |
| 12166 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12167 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 12168 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12169 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12170 | { } |
| 12171 | }; |
| 12172 | |
| 12173 | /* toggle speaker-output according to the hp-jack state */ |
| 12174 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 12175 | { |
| 12176 | unsigned int present; |
| 12177 | |
| 12178 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 12179 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12180 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 12181 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 12182 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 12183 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12184 | } |
| 12185 | |
| 12186 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 12187 | unsigned int res) |
| 12188 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12189 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12190 | alc861_toshiba_automute(codec); |
| 12191 | } |
| 12192 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12193 | /* pcm configuration: identiacal with ALC880 */ |
| 12194 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 12195 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 12196 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 12197 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 12198 | |
| 12199 | |
| 12200 | #define ALC861_DIGOUT_NID 0x07 |
| 12201 | |
| 12202 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 12203 | { 8, NULL } |
| 12204 | }; |
| 12205 | |
| 12206 | static hda_nid_t alc861_dac_nids[4] = { |
| 12207 | /* front, surround, clfe, side */ |
| 12208 | 0x03, 0x06, 0x05, 0x04 |
| 12209 | }; |
| 12210 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12211 | static hda_nid_t alc660_dac_nids[3] = { |
| 12212 | /* front, clfe, surround */ |
| 12213 | 0x03, 0x05, 0x06 |
| 12214 | }; |
| 12215 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12216 | static hda_nid_t alc861_adc_nids[1] = { |
| 12217 | /* ADC0-2 */ |
| 12218 | 0x08, |
| 12219 | }; |
| 12220 | |
| 12221 | static struct hda_input_mux alc861_capture_source = { |
| 12222 | .num_items = 5, |
| 12223 | .items = { |
| 12224 | { "Mic", 0x0 }, |
| 12225 | { "Front Mic", 0x3 }, |
| 12226 | { "Line", 0x1 }, |
| 12227 | { "CD", 0x4 }, |
| 12228 | { "Mixer", 0x5 }, |
| 12229 | }, |
| 12230 | }; |
| 12231 | |
| 12232 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12233 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 12234 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12235 | { |
| 12236 | int i; |
| 12237 | hda_nid_t nid; |
| 12238 | |
| 12239 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12240 | for (i = 0; i < cfg->line_outs; i++) { |
| 12241 | nid = cfg->line_out_pins[i]; |
| 12242 | if (nid) { |
| 12243 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 12244 | continue; |
| 12245 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 12246 | } |
| 12247 | } |
| 12248 | spec->multiout.num_dacs = cfg->line_outs; |
| 12249 | return 0; |
| 12250 | } |
| 12251 | |
| 12252 | /* add playback controls from the parsed DAC table */ |
| 12253 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12254 | const struct auto_pin_cfg *cfg) |
| 12255 | { |
| 12256 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12257 | static const char *chname[4] = { |
| 12258 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 12259 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12260 | hda_nid_t nid; |
| 12261 | int i, idx, err; |
| 12262 | |
| 12263 | for (i = 0; i < cfg->line_outs; i++) { |
| 12264 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12265 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12266 | continue; |
| 12267 | if (nid == 0x05) { |
| 12268 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12269 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12270 | "Center Playback Switch", |
| 12271 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 12272 | HDA_OUTPUT)); |
| 12273 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12274 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12275 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12276 | "LFE Playback Switch", |
| 12277 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12278 | HDA_OUTPUT)); |
| 12279 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12280 | return err; |
| 12281 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12282 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 12283 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12284 | if (nid == alc861_dac_nids[idx]) |
| 12285 | break; |
| 12286 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12287 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12288 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12289 | HDA_OUTPUT)); |
| 12290 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12291 | return err; |
| 12292 | } |
| 12293 | } |
| 12294 | return 0; |
| 12295 | } |
| 12296 | |
| 12297 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 12298 | { |
| 12299 | int err; |
| 12300 | hda_nid_t nid; |
| 12301 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12302 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12303 | return 0; |
| 12304 | |
| 12305 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 12306 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12307 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12308 | "Headphone Playback Switch", |
| 12309 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12310 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12311 | return err; |
| 12312 | spec->multiout.hp_nid = nid; |
| 12313 | } |
| 12314 | return 0; |
| 12315 | } |
| 12316 | |
| 12317 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12318 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12319 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12320 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12321 | struct hda_input_mux *imux = &spec->private_imux; |
| 12322 | int i, err, idx, idx1; |
| 12323 | |
| 12324 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12325 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12326 | case 0x0c: |
| 12327 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12328 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12329 | break; |
| 12330 | case 0x0f: |
| 12331 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12332 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12333 | break; |
| 12334 | case 0x0d: |
| 12335 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12336 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12337 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12338 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12339 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12340 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12341 | break; |
| 12342 | case 0x11: |
| 12343 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12344 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12345 | break; |
| 12346 | default: |
| 12347 | continue; |
| 12348 | } |
| 12349 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 12350 | err = new_analog_input(spec, cfg->input_pins[i], |
| 12351 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12352 | if (err < 0) |
| 12353 | return err; |
| 12354 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 12355 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12356 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12357 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12358 | } |
| 12359 | return 0; |
| 12360 | } |
| 12361 | |
| 12362 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 12363 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12364 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12365 | |
| 12366 | { |
| 12367 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12368 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12369 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12370 | */ |
| 12371 | /* .name = "Capture Source", */ |
| 12372 | .name = "Input Source", |
| 12373 | .count = 1, |
| 12374 | .info = alc_mux_enum_info, |
| 12375 | .get = alc_mux_enum_get, |
| 12376 | .put = alc_mux_enum_put, |
| 12377 | }, |
| 12378 | { } /* end */ |
| 12379 | }; |
| 12380 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12381 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12382 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12383 | int pin_type, int dac_idx) |
| 12384 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 12385 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12386 | pin_type); |
| 12387 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12388 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12389 | } |
| 12390 | |
| 12391 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 12392 | { |
| 12393 | struct alc_spec *spec = codec->spec; |
| 12394 | int i; |
| 12395 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12396 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12397 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 12398 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12399 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12400 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12401 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12402 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12403 | } |
| 12404 | } |
| 12405 | |
| 12406 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 12407 | { |
| 12408 | struct alc_spec *spec = codec->spec; |
| 12409 | hda_nid_t pin; |
| 12410 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 12411 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12412 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12413 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 12414 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12415 | pin = spec->autocfg.speaker_pins[0]; |
| 12416 | if (pin) |
| 12417 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12418 | } |
| 12419 | |
| 12420 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 12421 | { |
| 12422 | struct alc_spec *spec = codec->spec; |
| 12423 | int i; |
| 12424 | |
| 12425 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12426 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12427 | if (nid >= 0x0c && nid <= 0x11) { |
| 12428 | snd_hda_codec_write(codec, nid, 0, |
| 12429 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12430 | i <= AUTO_PIN_FRONT_MIC ? |
| 12431 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12432 | } |
| 12433 | } |
| 12434 | } |
| 12435 | |
| 12436 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12437 | /* return 1 if successful, 0 if the proper config is not found, |
| 12438 | * or a negative error code |
| 12439 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12440 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 12441 | { |
| 12442 | struct alc_spec *spec = codec->spec; |
| 12443 | int err; |
| 12444 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 12445 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12446 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12447 | alc861_ignore); |
| 12448 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12449 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12450 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12451 | return 0; /* can't find valid BIOS pin config */ |
| 12452 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12453 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12454 | if (err < 0) |
| 12455 | return err; |
| 12456 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12457 | if (err < 0) |
| 12458 | return err; |
| 12459 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 12460 | if (err < 0) |
| 12461 | return err; |
| 12462 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12463 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12464 | return err; |
| 12465 | |
| 12466 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12467 | |
| 12468 | if (spec->autocfg.dig_out_pin) |
| 12469 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 12470 | |
| 12471 | if (spec->kctl_alloc) |
| 12472 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12473 | |
| 12474 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 12475 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12476 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12477 | spec->input_mux = &spec->private_imux; |
| 12478 | |
| 12479 | spec->adc_nids = alc861_adc_nids; |
| 12480 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 12481 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 12482 | spec->num_mixers++; |
| 12483 | |
| 12484 | return 1; |
| 12485 | } |
| 12486 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12487 | /* additional initialization for auto-configuration model */ |
| 12488 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12489 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12490 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12491 | alc861_auto_init_multi_out(codec); |
| 12492 | alc861_auto_init_hp_out(codec); |
| 12493 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12494 | if (spec->unsol_event) |
| 12495 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12496 | } |
| 12497 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12498 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12499 | static struct hda_amp_list alc861_loopbacks[] = { |
| 12500 | { 0x15, HDA_INPUT, 0 }, |
| 12501 | { 0x15, HDA_INPUT, 1 }, |
| 12502 | { 0x15, HDA_INPUT, 2 }, |
| 12503 | { 0x15, HDA_INPUT, 3 }, |
| 12504 | { } /* end */ |
| 12505 | }; |
| 12506 | #endif |
| 12507 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12508 | |
| 12509 | /* |
| 12510 | * configuration and preset |
| 12511 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12512 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 12513 | [ALC861_3ST] = "3stack", |
| 12514 | [ALC660_3ST] = "3stack-660", |
| 12515 | [ALC861_3ST_DIG] = "3stack-dig", |
| 12516 | [ALC861_6ST_DIG] = "6stack-dig", |
| 12517 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 12518 | [ALC861_TOSHIBA] = "toshiba", |
| 12519 | [ALC861_ASUS] = "asus", |
| 12520 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 12521 | [ALC861_AUTO] = "auto", |
| 12522 | }; |
| 12523 | |
| 12524 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 12525 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12526 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12527 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12528 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12529 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12530 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 12531 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 12532 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 12533 | * Any other models that need this preset? |
| 12534 | */ |
| 12535 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 12536 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 12537 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12538 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 12539 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 12540 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 12541 | /* FIXME: the below seems conflict */ |
| 12542 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 12543 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 12544 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12545 | {} |
| 12546 | }; |
| 12547 | |
| 12548 | static struct alc_config_preset alc861_presets[] = { |
| 12549 | [ALC861_3ST] = { |
| 12550 | .mixers = { alc861_3ST_mixer }, |
| 12551 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12552 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12553 | .dac_nids = alc861_dac_nids, |
| 12554 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12555 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12556 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12557 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12558 | .adc_nids = alc861_adc_nids, |
| 12559 | .input_mux = &alc861_capture_source, |
| 12560 | }, |
| 12561 | [ALC861_3ST_DIG] = { |
| 12562 | .mixers = { alc861_base_mixer }, |
| 12563 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12564 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12565 | .dac_nids = alc861_dac_nids, |
| 12566 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12567 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12568 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12569 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12570 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12571 | .adc_nids = alc861_adc_nids, |
| 12572 | .input_mux = &alc861_capture_source, |
| 12573 | }, |
| 12574 | [ALC861_6ST_DIG] = { |
| 12575 | .mixers = { alc861_base_mixer }, |
| 12576 | .init_verbs = { alc861_base_init_verbs }, |
| 12577 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12578 | .dac_nids = alc861_dac_nids, |
| 12579 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12580 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 12581 | .channel_mode = alc861_8ch_modes, |
| 12582 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12583 | .adc_nids = alc861_adc_nids, |
| 12584 | .input_mux = &alc861_capture_source, |
| 12585 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12586 | [ALC660_3ST] = { |
| 12587 | .mixers = { alc861_3ST_mixer }, |
| 12588 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12589 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 12590 | .dac_nids = alc660_dac_nids, |
| 12591 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12592 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12593 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12594 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12595 | .adc_nids = alc861_adc_nids, |
| 12596 | .input_mux = &alc861_capture_source, |
| 12597 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12598 | [ALC861_UNIWILL_M31] = { |
| 12599 | .mixers = { alc861_uniwill_m31_mixer }, |
| 12600 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 12601 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12602 | .dac_nids = alc861_dac_nids, |
| 12603 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12604 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12605 | .channel_mode = alc861_uniwill_m31_modes, |
| 12606 | .need_dac_fix = 1, |
| 12607 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12608 | .adc_nids = alc861_adc_nids, |
| 12609 | .input_mux = &alc861_capture_source, |
| 12610 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12611 | [ALC861_TOSHIBA] = { |
| 12612 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12613 | .init_verbs = { alc861_base_init_verbs, |
| 12614 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12615 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12616 | .dac_nids = alc861_dac_nids, |
| 12617 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12618 | .channel_mode = alc883_3ST_2ch_modes, |
| 12619 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12620 | .adc_nids = alc861_adc_nids, |
| 12621 | .input_mux = &alc861_capture_source, |
| 12622 | .unsol_event = alc861_toshiba_unsol_event, |
| 12623 | .init_hook = alc861_toshiba_automute, |
| 12624 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12625 | [ALC861_ASUS] = { |
| 12626 | .mixers = { alc861_asus_mixer }, |
| 12627 | .init_verbs = { alc861_asus_init_verbs }, |
| 12628 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12629 | .dac_nids = alc861_dac_nids, |
| 12630 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12631 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 12632 | .channel_mode = alc861_asus_modes, |
| 12633 | .need_dac_fix = 1, |
| 12634 | .hp_nid = 0x06, |
| 12635 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12636 | .adc_nids = alc861_adc_nids, |
| 12637 | .input_mux = &alc861_capture_source, |
| 12638 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12639 | [ALC861_ASUS_LAPTOP] = { |
| 12640 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 12641 | .init_verbs = { alc861_asus_init_verbs, |
| 12642 | alc861_asus_laptop_init_verbs }, |
| 12643 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12644 | .dac_nids = alc861_dac_nids, |
| 12645 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12646 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12647 | .channel_mode = alc883_3ST_2ch_modes, |
| 12648 | .need_dac_fix = 1, |
| 12649 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12650 | .adc_nids = alc861_adc_nids, |
| 12651 | .input_mux = &alc861_capture_source, |
| 12652 | }, |
| 12653 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12654 | |
| 12655 | |
| 12656 | static int patch_alc861(struct hda_codec *codec) |
| 12657 | { |
| 12658 | struct alc_spec *spec; |
| 12659 | int board_config; |
| 12660 | int err; |
| 12661 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12662 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12663 | if (spec == NULL) |
| 12664 | return -ENOMEM; |
| 12665 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12666 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12667 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12668 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 12669 | alc861_models, |
| 12670 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12671 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12672 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12673 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 12674 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12675 | board_config = ALC861_AUTO; |
| 12676 | } |
| 12677 | |
| 12678 | if (board_config == ALC861_AUTO) { |
| 12679 | /* automatic parse from the BIOS config */ |
| 12680 | err = alc861_parse_auto_config(codec); |
| 12681 | if (err < 0) { |
| 12682 | alc_free(codec); |
| 12683 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12684 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12685 | printk(KERN_INFO |
| 12686 | "hda_codec: Cannot set up configuration " |
| 12687 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12688 | board_config = ALC861_3ST_DIG; |
| 12689 | } |
| 12690 | } |
| 12691 | |
| 12692 | if (board_config != ALC861_AUTO) |
| 12693 | setup_preset(spec, &alc861_presets[board_config]); |
| 12694 | |
| 12695 | spec->stream_name_analog = "ALC861 Analog"; |
| 12696 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 12697 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 12698 | |
| 12699 | spec->stream_name_digital = "ALC861 Digital"; |
| 12700 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 12701 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 12702 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12703 | spec->vmaster_nid = 0x03; |
| 12704 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12705 | codec->patch_ops = alc_patch_ops; |
| 12706 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12707 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12708 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12709 | if (!spec->loopback.amplist) |
| 12710 | spec->loopback.amplist = alc861_loopbacks; |
| 12711 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12712 | |
| 12713 | return 0; |
| 12714 | } |
| 12715 | |
| 12716 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12717 | * ALC861-VD support |
| 12718 | * |
| 12719 | * Based on ALC882 |
| 12720 | * |
| 12721 | * In addition, an independent DAC |
| 12722 | */ |
| 12723 | #define ALC861VD_DIGOUT_NID 0x06 |
| 12724 | |
| 12725 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 12726 | /* front, surr, clfe, side surr */ |
| 12727 | 0x02, 0x03, 0x04, 0x05 |
| 12728 | }; |
| 12729 | |
| 12730 | /* dac_nids for ALC660vd are in a different order - according to |
| 12731 | * Realtek's driver. |
| 12732 | * This should probably tesult in a different mixer for 6stack models |
| 12733 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 12734 | * - and it is the same as in 861vd. |
| 12735 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 12736 | */ |
| 12737 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 12738 | /* front, rear, clfe, rear_surr */ |
| 12739 | 0x02, 0x04, 0x03 |
| 12740 | }; |
| 12741 | |
| 12742 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 12743 | /* ADC0 */ |
| 12744 | 0x09, |
| 12745 | }; |
| 12746 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12747 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 12748 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12749 | /* input MUX */ |
| 12750 | /* FIXME: should be a matrix-type input source selection */ |
| 12751 | static struct hda_input_mux alc861vd_capture_source = { |
| 12752 | .num_items = 4, |
| 12753 | .items = { |
| 12754 | { "Mic", 0x0 }, |
| 12755 | { "Front Mic", 0x1 }, |
| 12756 | { "Line", 0x2 }, |
| 12757 | { "CD", 0x4 }, |
| 12758 | }, |
| 12759 | }; |
| 12760 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12761 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12762 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12763 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12764 | { "Ext Mic", 0x0 }, |
| 12765 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12766 | }, |
| 12767 | }; |
| 12768 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12769 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 12770 | .num_items = 2, |
| 12771 | .items = { |
| 12772 | { "Front Mic", 0x0 }, |
| 12773 | { "ATAPI Mic", 0x1 }, |
| 12774 | }, |
| 12775 | }; |
| 12776 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12777 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 12778 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12779 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 12780 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12781 | |
| 12782 | /* |
| 12783 | * 2ch mode |
| 12784 | */ |
| 12785 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 12786 | { 2, NULL } |
| 12787 | }; |
| 12788 | |
| 12789 | /* |
| 12790 | * 6ch mode |
| 12791 | */ |
| 12792 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 12793 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12794 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12795 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12796 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12797 | { } /* end */ |
| 12798 | }; |
| 12799 | |
| 12800 | /* |
| 12801 | * 8ch mode |
| 12802 | */ |
| 12803 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 12804 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12805 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12806 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12807 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12808 | { } /* end */ |
| 12809 | }; |
| 12810 | |
| 12811 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 12812 | { 6, alc861vd_6stack_ch6_init }, |
| 12813 | { 8, alc861vd_6stack_ch8_init }, |
| 12814 | }; |
| 12815 | |
| 12816 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 12817 | { |
| 12818 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12819 | .name = "Channel Mode", |
| 12820 | .info = alc_ch_mode_info, |
| 12821 | .get = alc_ch_mode_get, |
| 12822 | .put = alc_ch_mode_put, |
| 12823 | }, |
| 12824 | { } /* end */ |
| 12825 | }; |
| 12826 | |
| 12827 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 12828 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 12829 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 12830 | |
| 12831 | { |
| 12832 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12833 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12834 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12835 | */ |
| 12836 | /* .name = "Capture Source", */ |
| 12837 | .name = "Input Source", |
| 12838 | .count = 1, |
| 12839 | .info = alc861vd_mux_enum_info, |
| 12840 | .get = alc861vd_mux_enum_get, |
| 12841 | .put = alc861vd_mux_enum_put, |
| 12842 | }, |
| 12843 | { } /* end */ |
| 12844 | }; |
| 12845 | |
| 12846 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12847 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12848 | */ |
| 12849 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 12850 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12851 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12852 | |
| 12853 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12854 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12855 | |
| 12856 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 12857 | HDA_OUTPUT), |
| 12858 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 12859 | HDA_OUTPUT), |
| 12860 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12861 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 12862 | |
| 12863 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 12864 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12865 | |
| 12866 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12867 | |
| 12868 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12869 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12870 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12871 | |
| 12872 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12873 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12874 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12875 | |
| 12876 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12877 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12878 | |
| 12879 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12880 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12881 | |
| 12882 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12883 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12884 | |
| 12885 | { } /* end */ |
| 12886 | }; |
| 12887 | |
| 12888 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 12889 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12890 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12891 | |
| 12892 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12893 | |
| 12894 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12895 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12896 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12897 | |
| 12898 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12899 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12900 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12901 | |
| 12902 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12903 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12904 | |
| 12905 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12906 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12907 | |
| 12908 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12909 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12910 | |
| 12911 | { } /* end */ |
| 12912 | }; |
| 12913 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12914 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 12915 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12916 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 12917 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12918 | |
| 12919 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12920 | |
| 12921 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12922 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12923 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12924 | |
| 12925 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12926 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12927 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12928 | |
| 12929 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12930 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12931 | |
| 12932 | { } /* end */ |
| 12933 | }; |
| 12934 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12935 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 12936 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12937 | */ |
| 12938 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12939 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12940 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12941 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12942 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12943 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12944 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12945 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12946 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12947 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12948 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12949 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 12950 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12951 | { } /* end */ |
| 12952 | }; |
| 12953 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12954 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12955 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12956 | */ |
| 12957 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12958 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12959 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12960 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12961 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12962 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12963 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12964 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12965 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12966 | |
| 12967 | { } /* end */ |
| 12968 | }; |
| 12969 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12970 | /* |
| 12971 | * generic initialization of ADC, input mixers and output mixers |
| 12972 | */ |
| 12973 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12974 | /* |
| 12975 | * Unmute ADC0 and set the default input to mic-in |
| 12976 | */ |
| 12977 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12978 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12979 | |
| 12980 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12981 | * the analog-loopback mixer widget |
| 12982 | */ |
| 12983 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12984 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12985 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12986 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12987 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12988 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12989 | |
| 12990 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12991 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12992 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12993 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12994 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12995 | |
| 12996 | /* |
| 12997 | * Set up output mixers (0x02 - 0x05) |
| 12998 | */ |
| 12999 | /* set vol=0 to output mixers */ |
| 13000 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13001 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13002 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13003 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13004 | |
| 13005 | /* set up input amps for analog loopback */ |
| 13006 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13007 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13008 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13009 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13010 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13011 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13012 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13013 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13014 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13015 | |
| 13016 | { } |
| 13017 | }; |
| 13018 | |
| 13019 | /* |
| 13020 | * 3-stack pin configuration: |
| 13021 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 13022 | */ |
| 13023 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 13024 | /* |
| 13025 | * Set pin mode and muting |
| 13026 | */ |
| 13027 | /* set front pin widgets 0x14 for output */ |
| 13028 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13029 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13030 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13031 | |
| 13032 | /* Mic (rear) pin: input vref at 80% */ |
| 13033 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13034 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13035 | /* Front Mic pin: input vref at 80% */ |
| 13036 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13037 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13038 | /* Line In pin: input */ |
| 13039 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13040 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13041 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13042 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13043 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13044 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13045 | /* CD pin widget for input */ |
| 13046 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13047 | |
| 13048 | { } |
| 13049 | }; |
| 13050 | |
| 13051 | /* |
| 13052 | * 6-stack pin configuration: |
| 13053 | */ |
| 13054 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 13055 | /* |
| 13056 | * Set pin mode and muting |
| 13057 | */ |
| 13058 | /* set front pin widgets 0x14 for output */ |
| 13059 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13060 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13061 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13062 | |
| 13063 | /* Rear Pin: output 1 (0x0d) */ |
| 13064 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13065 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13066 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13067 | /* CLFE Pin: output 2 (0x0e) */ |
| 13068 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13069 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13070 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 13071 | /* Side Pin: output 3 (0x0f) */ |
| 13072 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13073 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13074 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 13075 | |
| 13076 | /* Mic (rear) pin: input vref at 80% */ |
| 13077 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13078 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13079 | /* Front Mic pin: input vref at 80% */ |
| 13080 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13081 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13082 | /* Line In pin: input */ |
| 13083 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13084 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13085 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13086 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13087 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13088 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13089 | /* CD pin widget for input */ |
| 13090 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13091 | |
| 13092 | { } |
| 13093 | }; |
| 13094 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13095 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 13096 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13097 | { } |
| 13098 | }; |
| 13099 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 13100 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 13101 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13102 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13103 | { } |
| 13104 | }; |
| 13105 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13106 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 13107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13108 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13109 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 13110 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13111 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13112 | {} |
| 13113 | }; |
| 13114 | |
| 13115 | /* toggle speaker-output according to the hp-jack state */ |
| 13116 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 13117 | { |
| 13118 | unsigned int present; |
| 13119 | unsigned char bits; |
| 13120 | |
| 13121 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13122 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13123 | bits = present ? HDA_AMP_MUTE : 0; |
| 13124 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13125 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13126 | } |
| 13127 | |
| 13128 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 13129 | { |
| 13130 | unsigned int present; |
| 13131 | unsigned char bits; |
| 13132 | |
| 13133 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13134 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13135 | bits = present ? HDA_AMP_MUTE : 0; |
| 13136 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 13137 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13138 | } |
| 13139 | |
| 13140 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 13141 | { |
| 13142 | alc861vd_lenovo_hp_automute(codec); |
| 13143 | alc861vd_lenovo_mic_automute(codec); |
| 13144 | } |
| 13145 | |
| 13146 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 13147 | unsigned int res) |
| 13148 | { |
| 13149 | switch (res >> 26) { |
| 13150 | case ALC880_HP_EVENT: |
| 13151 | alc861vd_lenovo_hp_automute(codec); |
| 13152 | break; |
| 13153 | case ALC880_MIC_EVENT: |
| 13154 | alc861vd_lenovo_mic_automute(codec); |
| 13155 | break; |
| 13156 | } |
| 13157 | } |
| 13158 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13159 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 13160 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13161 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13162 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13163 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13164 | |
| 13165 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13166 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13167 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13168 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13169 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13170 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13171 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13172 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13173 | |
| 13174 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13175 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13176 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13177 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13178 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13179 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13180 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13181 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13182 | |
| 13183 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13184 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13185 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13186 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13187 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13188 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13189 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13190 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13191 | |
| 13192 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13193 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13194 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13195 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13196 | |
| 13197 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13198 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13199 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13200 | |
| 13201 | { } /* end */ |
| 13202 | }; |
| 13203 | |
| 13204 | /* toggle speaker-output according to the hp-jack state */ |
| 13205 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 13206 | { |
| 13207 | unsigned int present; |
| 13208 | |
| 13209 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13210 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13211 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13212 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13213 | } |
| 13214 | |
| 13215 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 13216 | { |
| 13217 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13218 | alc861vd_dallas_automute(codec); |
| 13219 | } |
| 13220 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13221 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13222 | #define alc861vd_loopbacks alc880_loopbacks |
| 13223 | #endif |
| 13224 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13225 | /* pcm configuration: identiacal with ALC880 */ |
| 13226 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 13227 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 13228 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 13229 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 13230 | |
| 13231 | /* |
| 13232 | * configuration and preset |
| 13233 | */ |
| 13234 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 13235 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13236 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13237 | [ALC861VD_3ST] = "3stack", |
| 13238 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 13239 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13240 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13241 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13242 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13243 | [ALC861VD_AUTO] = "auto", |
| 13244 | }; |
| 13245 | |
| 13246 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13247 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 13248 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 13249 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13250 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Alexander Holler | 2522d73 | 2008-07-17 23:36:15 +0200 | [diff] [blame] | 13251 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13252 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13253 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13254 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 13255 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13256 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 13257 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13258 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 13259 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13260 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 13261 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Takashi Iwai | be321a89 | 2008-07-07 16:04:04 +0200 | [diff] [blame] | 13262 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 13263 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13264 | {} |
| 13265 | }; |
| 13266 | |
| 13267 | static struct alc_config_preset alc861vd_presets[] = { |
| 13268 | [ALC660VD_3ST] = { |
| 13269 | .mixers = { alc861vd_3st_mixer }, |
| 13270 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13271 | alc861vd_3stack_init_verbs }, |
| 13272 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13273 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13274 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13275 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13276 | .input_mux = &alc861vd_capture_source, |
| 13277 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13278 | [ALC660VD_3ST_DIG] = { |
| 13279 | .mixers = { alc861vd_3st_mixer }, |
| 13280 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13281 | alc861vd_3stack_init_verbs }, |
| 13282 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13283 | .dac_nids = alc660vd_dac_nids, |
| 13284 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13285 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13286 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13287 | .input_mux = &alc861vd_capture_source, |
| 13288 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13289 | [ALC861VD_3ST] = { |
| 13290 | .mixers = { alc861vd_3st_mixer }, |
| 13291 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13292 | alc861vd_3stack_init_verbs }, |
| 13293 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13294 | .dac_nids = alc861vd_dac_nids, |
| 13295 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13296 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13297 | .input_mux = &alc861vd_capture_source, |
| 13298 | }, |
| 13299 | [ALC861VD_3ST_DIG] = { |
| 13300 | .mixers = { alc861vd_3st_mixer }, |
| 13301 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13302 | alc861vd_3stack_init_verbs }, |
| 13303 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13304 | .dac_nids = alc861vd_dac_nids, |
| 13305 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 13306 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13307 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13308 | .input_mux = &alc861vd_capture_source, |
| 13309 | }, |
| 13310 | [ALC861VD_6ST_DIG] = { |
| 13311 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 13312 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13313 | alc861vd_6stack_init_verbs }, |
| 13314 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13315 | .dac_nids = alc861vd_dac_nids, |
| 13316 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 13317 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 13318 | .channel_mode = alc861vd_6stack_modes, |
| 13319 | .input_mux = &alc861vd_capture_source, |
| 13320 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13321 | [ALC861VD_LENOVO] = { |
| 13322 | .mixers = { alc861vd_lenovo_mixer }, |
| 13323 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13324 | alc861vd_3stack_init_verbs, |
| 13325 | alc861vd_eapd_verbs, |
| 13326 | alc861vd_lenovo_unsol_verbs }, |
| 13327 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13328 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13329 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13330 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13331 | .input_mux = &alc861vd_capture_source, |
| 13332 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 13333 | .init_hook = alc861vd_lenovo_automute, |
| 13334 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13335 | [ALC861VD_DALLAS] = { |
| 13336 | .mixers = { alc861vd_dallas_mixer }, |
| 13337 | .init_verbs = { alc861vd_dallas_verbs }, |
| 13338 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13339 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13340 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13341 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13342 | .input_mux = &alc861vd_dallas_capture_source, |
| 13343 | .unsol_event = alc861vd_dallas_unsol_event, |
| 13344 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13345 | }, |
| 13346 | [ALC861VD_HP] = { |
| 13347 | .mixers = { alc861vd_hp_mixer }, |
| 13348 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 13349 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13350 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13351 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13352 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13353 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13354 | .input_mux = &alc861vd_hp_capture_source, |
| 13355 | .unsol_event = alc861vd_dallas_unsol_event, |
| 13356 | .init_hook = alc861vd_dallas_automute, |
| 13357 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13358 | }; |
| 13359 | |
| 13360 | /* |
| 13361 | * BIOS auto configuration |
| 13362 | */ |
| 13363 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13364 | hda_nid_t nid, int pin_type, int dac_idx) |
| 13365 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13366 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13367 | } |
| 13368 | |
| 13369 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 13370 | { |
| 13371 | struct alc_spec *spec = codec->spec; |
| 13372 | int i; |
| 13373 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13374 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13375 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13376 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13377 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13378 | if (nid) |
| 13379 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13380 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13381 | } |
| 13382 | } |
| 13383 | |
| 13384 | |
| 13385 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 13386 | { |
| 13387 | struct alc_spec *spec = codec->spec; |
| 13388 | hda_nid_t pin; |
| 13389 | |
| 13390 | pin = spec->autocfg.hp_pins[0]; |
| 13391 | if (pin) /* connect to front and use dac 0 */ |
| 13392 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13393 | pin = spec->autocfg.speaker_pins[0]; |
| 13394 | if (pin) |
| 13395 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13396 | } |
| 13397 | |
| 13398 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13399 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 13400 | |
| 13401 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 13402 | { |
| 13403 | struct alc_spec *spec = codec->spec; |
| 13404 | int i; |
| 13405 | |
| 13406 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13407 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13408 | if (alc861vd_is_input_pin(nid)) { |
| 13409 | snd_hda_codec_write(codec, nid, 0, |
| 13410 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13411 | i <= AUTO_PIN_FRONT_MIC ? |
| 13412 | PIN_VREF80 : PIN_IN); |
| 13413 | if (nid != ALC861VD_PIN_CD_NID) |
| 13414 | snd_hda_codec_write(codec, nid, 0, |
| 13415 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13416 | AMP_OUT_MUTE); |
| 13417 | } |
| 13418 | } |
| 13419 | } |
| 13420 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 13421 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 13422 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13423 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 13424 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 13425 | |
| 13426 | /* add playback controls from the parsed DAC table */ |
| 13427 | /* Based on ALC880 version. But ALC861VD has separate, |
| 13428 | * different NIDs for mute/unmute switch and volume control */ |
| 13429 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13430 | const struct auto_pin_cfg *cfg) |
| 13431 | { |
| 13432 | char name[32]; |
| 13433 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 13434 | hda_nid_t nid_v, nid_s; |
| 13435 | int i, err; |
| 13436 | |
| 13437 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13438 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13439 | continue; |
| 13440 | nid_v = alc861vd_idx_to_mixer_vol( |
| 13441 | alc880_dac_to_idx( |
| 13442 | spec->multiout.dac_nids[i])); |
| 13443 | nid_s = alc861vd_idx_to_mixer_switch( |
| 13444 | alc880_dac_to_idx( |
| 13445 | spec->multiout.dac_nids[i])); |
| 13446 | |
| 13447 | if (i == 2) { |
| 13448 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13449 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13450 | "Center Playback Volume", |
| 13451 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 13452 | HDA_OUTPUT)); |
| 13453 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13454 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13455 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13456 | "LFE Playback Volume", |
| 13457 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 13458 | HDA_OUTPUT)); |
| 13459 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13460 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13461 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13462 | "Center Playback Switch", |
| 13463 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 13464 | HDA_INPUT)); |
| 13465 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13466 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13467 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13468 | "LFE Playback Switch", |
| 13469 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 13470 | HDA_INPUT)); |
| 13471 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13472 | return err; |
| 13473 | } else { |
| 13474 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13475 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13476 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 13477 | HDA_OUTPUT)); |
| 13478 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13479 | return err; |
| 13480 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13481 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13482 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13483 | HDA_INPUT)); |
| 13484 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13485 | return err; |
| 13486 | } |
| 13487 | } |
| 13488 | return 0; |
| 13489 | } |
| 13490 | |
| 13491 | /* add playback controls for speaker and HP outputs */ |
| 13492 | /* Based on ALC880 version. But ALC861VD has separate, |
| 13493 | * different NIDs for mute/unmute switch and volume control */ |
| 13494 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 13495 | hda_nid_t pin, const char *pfx) |
| 13496 | { |
| 13497 | hda_nid_t nid_v, nid_s; |
| 13498 | int err; |
| 13499 | char name[32]; |
| 13500 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13501 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13502 | return 0; |
| 13503 | |
| 13504 | if (alc880_is_fixed_pin(pin)) { |
| 13505 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13506 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13507 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13508 | spec->multiout.hp_nid = nid_v; |
| 13509 | else |
| 13510 | spec->multiout.extra_out_nid[0] = nid_v; |
| 13511 | /* control HP volume/switch on the output mixer amp */ |
| 13512 | nid_v = alc861vd_idx_to_mixer_vol( |
| 13513 | alc880_fixed_pin_idx(pin)); |
| 13514 | nid_s = alc861vd_idx_to_mixer_switch( |
| 13515 | alc880_fixed_pin_idx(pin)); |
| 13516 | |
| 13517 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13518 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13519 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 13520 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13521 | return err; |
| 13522 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13523 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13524 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 13525 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13526 | return err; |
| 13527 | } else if (alc880_is_multi_pin(pin)) { |
| 13528 | /* set manual connection */ |
| 13529 | /* we have only a switch on HP-out PIN */ |
| 13530 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13531 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13532 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13533 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13534 | return err; |
| 13535 | } |
| 13536 | return 0; |
| 13537 | } |
| 13538 | |
| 13539 | /* parse the BIOS configuration and set up the alc_spec |
| 13540 | * return 1 if successful, 0 if the proper config is not found, |
| 13541 | * or a negative error code |
| 13542 | * Based on ALC880 version - had to change it to override |
| 13543 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 13544 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 13545 | { |
| 13546 | struct alc_spec *spec = codec->spec; |
| 13547 | int err; |
| 13548 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 13549 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13550 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13551 | alc861vd_ignore); |
| 13552 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13553 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13554 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13555 | return 0; /* can't find valid BIOS pin config */ |
| 13556 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13557 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13558 | if (err < 0) |
| 13559 | return err; |
| 13560 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13561 | if (err < 0) |
| 13562 | return err; |
| 13563 | err = alc861vd_auto_create_extra_out(spec, |
| 13564 | spec->autocfg.speaker_pins[0], |
| 13565 | "Speaker"); |
| 13566 | if (err < 0) |
| 13567 | return err; |
| 13568 | err = alc861vd_auto_create_extra_out(spec, |
| 13569 | spec->autocfg.hp_pins[0], |
| 13570 | "Headphone"); |
| 13571 | if (err < 0) |
| 13572 | return err; |
| 13573 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13574 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13575 | return err; |
| 13576 | |
| 13577 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13578 | |
| 13579 | if (spec->autocfg.dig_out_pin) |
| 13580 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 13581 | |
| 13582 | if (spec->kctl_alloc) |
| 13583 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13584 | |
| 13585 | spec->init_verbs[spec->num_init_verbs++] |
| 13586 | = alc861vd_volume_init_verbs; |
| 13587 | |
| 13588 | spec->num_mux_defs = 1; |
| 13589 | spec->input_mux = &spec->private_imux; |
| 13590 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13591 | err = alc_auto_add_mic_boost(codec); |
| 13592 | if (err < 0) |
| 13593 | return err; |
| 13594 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13595 | return 1; |
| 13596 | } |
| 13597 | |
| 13598 | /* additional initialization for auto-configuration model */ |
| 13599 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 13600 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13601 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13602 | alc861vd_auto_init_multi_out(codec); |
| 13603 | alc861vd_auto_init_hp_out(codec); |
| 13604 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 13605 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13606 | if (spec->unsol_event) |
| 13607 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13608 | } |
| 13609 | |
| 13610 | static int patch_alc861vd(struct hda_codec *codec) |
| 13611 | { |
| 13612 | struct alc_spec *spec; |
| 13613 | int err, board_config; |
| 13614 | |
| 13615 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13616 | if (spec == NULL) |
| 13617 | return -ENOMEM; |
| 13618 | |
| 13619 | codec->spec = spec; |
| 13620 | |
| 13621 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 13622 | alc861vd_models, |
| 13623 | alc861vd_cfg_tbl); |
| 13624 | |
| 13625 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 13626 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 13627 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 13628 | board_config = ALC861VD_AUTO; |
| 13629 | } |
| 13630 | |
| 13631 | if (board_config == ALC861VD_AUTO) { |
| 13632 | /* automatic parse from the BIOS config */ |
| 13633 | err = alc861vd_parse_auto_config(codec); |
| 13634 | if (err < 0) { |
| 13635 | alc_free(codec); |
| 13636 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13637 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13638 | printk(KERN_INFO |
| 13639 | "hda_codec: Cannot set up configuration " |
| 13640 | "from BIOS. Using base mode...\n"); |
| 13641 | board_config = ALC861VD_3ST; |
| 13642 | } |
| 13643 | } |
| 13644 | |
| 13645 | if (board_config != ALC861VD_AUTO) |
| 13646 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 13647 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 13648 | if (codec->vendor_id == 0x10ec0660) { |
| 13649 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 13650 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 13651 | /* always turn on EAPD */ |
| 13652 | spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 13653 | } else { |
| 13654 | spec->stream_name_analog = "ALC861VD Analog"; |
| 13655 | spec->stream_name_digital = "ALC861VD Digital"; |
| 13656 | } |
| 13657 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13658 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 13659 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 13660 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13661 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 13662 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 13663 | |
| 13664 | spec->adc_nids = alc861vd_adc_nids; |
| 13665 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13666 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13667 | |
| 13668 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 13669 | spec->num_mixers++; |
| 13670 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13671 | spec->vmaster_nid = 0x02; |
| 13672 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13673 | codec->patch_ops = alc_patch_ops; |
| 13674 | |
| 13675 | if (board_config == ALC861VD_AUTO) |
| 13676 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13677 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13678 | if (!spec->loopback.amplist) |
| 13679 | spec->loopback.amplist = alc861vd_loopbacks; |
| 13680 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13681 | |
| 13682 | return 0; |
| 13683 | } |
| 13684 | |
| 13685 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13686 | * ALC662 support |
| 13687 | * |
| 13688 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 13689 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 13690 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 13691 | * 6-channel independent captures. |
| 13692 | * |
| 13693 | * In addition, an independent DAC for the multi-playback (not used in this |
| 13694 | * driver yet). |
| 13695 | */ |
| 13696 | #define ALC662_DIGOUT_NID 0x06 |
| 13697 | #define ALC662_DIGIN_NID 0x0a |
| 13698 | |
| 13699 | static hda_nid_t alc662_dac_nids[4] = { |
| 13700 | /* front, rear, clfe, rear_surr */ |
| 13701 | 0x02, 0x03, 0x04 |
| 13702 | }; |
| 13703 | |
| 13704 | static hda_nid_t alc662_adc_nids[1] = { |
| 13705 | /* ADC1-2 */ |
| 13706 | 0x09, |
| 13707 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13708 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 13709 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13710 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13711 | /* input MUX */ |
| 13712 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13713 | static struct hda_input_mux alc662_capture_source = { |
| 13714 | .num_items = 4, |
| 13715 | .items = { |
| 13716 | { "Mic", 0x0 }, |
| 13717 | { "Front Mic", 0x1 }, |
| 13718 | { "Line", 0x2 }, |
| 13719 | { "CD", 0x4 }, |
| 13720 | }, |
| 13721 | }; |
| 13722 | |
| 13723 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 13724 | .num_items = 2, |
| 13725 | .items = { |
| 13726 | { "Mic", 0x1 }, |
| 13727 | { "Line", 0x2 }, |
| 13728 | }, |
| 13729 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13730 | |
| 13731 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 13732 | .num_items = 2, |
| 13733 | .items = { |
| 13734 | { "i-Mic", 0x1 }, |
| 13735 | { "e-Mic", 0x0 }, |
| 13736 | }, |
| 13737 | }; |
| 13738 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13739 | static struct hda_input_mux alc663_capture_source = { |
| 13740 | .num_items = 3, |
| 13741 | .items = { |
| 13742 | { "Mic", 0x0 }, |
| 13743 | { "Front Mic", 0x1 }, |
| 13744 | { "Line", 0x2 }, |
| 13745 | }, |
| 13746 | }; |
| 13747 | |
| 13748 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 13749 | .num_items = 2, |
| 13750 | .items = { |
| 13751 | { "Ext-Mic", 0x0 }, |
| 13752 | { "D-Mic", 0x9 }, |
| 13753 | }, |
| 13754 | }; |
| 13755 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13756 | #define alc662_mux_enum_info alc_mux_enum_info |
| 13757 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13758 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13759 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13760 | /* |
| 13761 | * 2ch mode |
| 13762 | */ |
| 13763 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 13764 | { 2, NULL } |
| 13765 | }; |
| 13766 | |
| 13767 | /* |
| 13768 | * 2ch mode |
| 13769 | */ |
| 13770 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 13771 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 13772 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13773 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 13774 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13775 | { } /* end */ |
| 13776 | }; |
| 13777 | |
| 13778 | /* |
| 13779 | * 6ch mode |
| 13780 | */ |
| 13781 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 13782 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13783 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13784 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 13785 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13786 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13787 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13788 | { } /* end */ |
| 13789 | }; |
| 13790 | |
| 13791 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 13792 | { 2, alc662_3ST_ch2_init }, |
| 13793 | { 6, alc662_3ST_ch6_init }, |
| 13794 | }; |
| 13795 | |
| 13796 | /* |
| 13797 | * 2ch mode |
| 13798 | */ |
| 13799 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 13800 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13801 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13802 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13803 | { } /* end */ |
| 13804 | }; |
| 13805 | |
| 13806 | /* |
| 13807 | * 6ch mode |
| 13808 | */ |
| 13809 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 13810 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13811 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13812 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13813 | { } /* end */ |
| 13814 | }; |
| 13815 | |
| 13816 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 13817 | { 2, alc662_sixstack_ch6_init }, |
| 13818 | { 6, alc662_sixstack_ch8_init }, |
| 13819 | }; |
| 13820 | |
| 13821 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13822 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13823 | */ |
| 13824 | |
| 13825 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 13826 | /* output mixer control */ |
| 13827 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13828 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13829 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13830 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13831 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13832 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13833 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13834 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13835 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13836 | |
| 13837 | /*Input mixer control */ |
| 13838 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 13839 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 13840 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 13841 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 13842 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 13843 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 13844 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 13845 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13846 | { } /* end */ |
| 13847 | }; |
| 13848 | |
| 13849 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 13850 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13851 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13852 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13853 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13854 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13855 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13856 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13857 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13858 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13859 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13860 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13861 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13862 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13863 | { } /* end */ |
| 13864 | }; |
| 13865 | |
| 13866 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 13867 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13868 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13869 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13870 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13871 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13872 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13873 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13874 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13875 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13876 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13877 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13878 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13879 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13880 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13881 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13882 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13883 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13884 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13885 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13886 | { } /* end */ |
| 13887 | }; |
| 13888 | |
| 13889 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 13890 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13891 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13892 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13893 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13894 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13895 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13896 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13897 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13898 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13899 | { } /* end */ |
| 13900 | }; |
| 13901 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13902 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13903 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13904 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 13905 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13906 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13907 | |
| 13908 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 13909 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13910 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13911 | |
| 13912 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 13913 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13914 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13915 | { } /* end */ |
| 13916 | }; |
| 13917 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13918 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 13919 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13920 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13921 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13922 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 13923 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13924 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13925 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13926 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13927 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13928 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13929 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13930 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13931 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13932 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13933 | { } /* end */ |
| 13934 | }; |
| 13935 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13936 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
| 13937 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13938 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13939 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13940 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13941 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13942 | HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), |
| 13943 | { } /* end */ |
| 13944 | }; |
| 13945 | |
| 13946 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 13947 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13948 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13949 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13950 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13951 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13952 | |
| 13953 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13954 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13955 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13956 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13957 | { } /* end */ |
| 13958 | }; |
| 13959 | |
| 13960 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 13961 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13962 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13963 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13964 | |
| 13965 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13966 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13967 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13968 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13969 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13970 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13971 | { } /* end */ |
| 13972 | }; |
| 13973 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13974 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 13975 | { |
| 13976 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13977 | .name = "Channel Mode", |
| 13978 | .info = alc_ch_mode_info, |
| 13979 | .get = alc_ch_mode_get, |
| 13980 | .put = alc_ch_mode_put, |
| 13981 | }, |
| 13982 | { } /* end */ |
| 13983 | }; |
| 13984 | |
| 13985 | static struct hda_verb alc662_init_verbs[] = { |
| 13986 | /* ADC: mute amp left and right */ |
| 13987 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13988 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13989 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 13990 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13991 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13992 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13993 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13994 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13995 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13996 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13997 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13998 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13999 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14000 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14001 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14002 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14003 | |
| 14004 | /* Front Pin: output 0 (0x0c) */ |
| 14005 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14006 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14007 | |
| 14008 | /* Rear Pin: output 1 (0x0d) */ |
| 14009 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14010 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14011 | |
| 14012 | /* CLFE Pin: output 2 (0x0e) */ |
| 14013 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14014 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14015 | |
| 14016 | /* Mic (rear) pin: input vref at 80% */ |
| 14017 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14018 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14019 | /* Front Mic pin: input vref at 80% */ |
| 14020 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14021 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14022 | /* Line In pin: input */ |
| 14023 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14024 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14025 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14026 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14027 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14028 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14029 | /* CD pin widget for input */ |
| 14030 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14031 | |
| 14032 | /* FIXME: use matrix-type input source selection */ |
| 14033 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 14034 | /* Input mixer */ |
| 14035 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14036 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14037 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14038 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14039 | |
| 14040 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14041 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14042 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14043 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14044 | |
| 14045 | /* always trun on EAPD */ |
| 14046 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14047 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14048 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14049 | { } |
| 14050 | }; |
| 14051 | |
| 14052 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 14053 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 14054 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14055 | {} |
| 14056 | }; |
| 14057 | |
| 14058 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 14059 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14060 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14061 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14062 | }; |
| 14063 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14064 | /* Set Unsolicited Event*/ |
| 14065 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 14066 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14067 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14068 | {} |
| 14069 | }; |
| 14070 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14071 | /* |
| 14072 | * generic initialization of ADC, input mixers and output mixers |
| 14073 | */ |
| 14074 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 14075 | /* |
| 14076 | * Unmute ADC and set the default input to mic-in |
| 14077 | */ |
| 14078 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14079 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14080 | |
| 14081 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 14082 | * mixer widget |
| 14083 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 14084 | * panel mic (mic 2) |
| 14085 | */ |
| 14086 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14087 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14088 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14089 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14090 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14091 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14092 | |
| 14093 | /* |
| 14094 | * Set up output mixers (0x0c - 0x0f) |
| 14095 | */ |
| 14096 | /* set vol=0 to output mixers */ |
| 14097 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14098 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14099 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14100 | |
| 14101 | /* set up input amps for analog loopback */ |
| 14102 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14103 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14104 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14105 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14106 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14107 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14108 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14109 | |
| 14110 | |
| 14111 | /* FIXME: use matrix-type input source selection */ |
| 14112 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 14113 | /* Input mixer */ |
| 14114 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14115 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14116 | { } |
| 14117 | }; |
| 14118 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 14119 | /* additional verbs for ALC663 */ |
| 14120 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 14121 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14122 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14123 | { } |
| 14124 | }; |
| 14125 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14126 | static struct hda_verb alc663_m51va_init_verbs[] = { |
| 14127 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14128 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14129 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14130 | |
| 14131 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 14132 | |
| 14133 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14134 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14135 | {} |
| 14136 | }; |
| 14137 | |
| 14138 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 14139 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14140 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 14141 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 14142 | |
| 14143 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14144 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14145 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14146 | |
| 14147 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 14148 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 14149 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 14150 | {} |
| 14151 | }; |
| 14152 | |
| 14153 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 14154 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14155 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14156 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14157 | |
| 14158 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14159 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14160 | {} |
| 14161 | }; |
| 14162 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14163 | /* capture mixer elements */ |
| 14164 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 14165 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14166 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14167 | { |
| 14168 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14169 | /* The multiple "Capture Source" controls confuse alsamixer |
| 14170 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14171 | */ |
| 14172 | /* .name = "Capture Source", */ |
| 14173 | .name = "Input Source", |
| 14174 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 14175 | .info = alc662_mux_enum_info, |
| 14176 | .get = alc662_mux_enum_get, |
| 14177 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14178 | }, |
| 14179 | { } /* end */ |
| 14180 | }; |
| 14181 | |
| 14182 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 14183 | { |
| 14184 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14185 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14186 | |
| 14187 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 14188 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14189 | bits = present ? HDA_AMP_MUTE : 0; |
| 14190 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14191 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14192 | } |
| 14193 | |
| 14194 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 14195 | { |
| 14196 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14197 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14198 | |
| 14199 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14200 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14201 | bits = present ? HDA_AMP_MUTE : 0; |
| 14202 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14203 | HDA_AMP_MUTE, bits); |
| 14204 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14205 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14206 | } |
| 14207 | |
| 14208 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 14209 | unsigned int res) |
| 14210 | { |
| 14211 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14212 | alc662_lenovo_101e_all_automute(codec); |
| 14213 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 14214 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 14215 | } |
| 14216 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14217 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 14218 | { |
| 14219 | unsigned int present; |
| 14220 | |
| 14221 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14222 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 14223 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14224 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 14225 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14226 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 14227 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14228 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 14229 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14230 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 14231 | } |
| 14232 | |
| 14233 | /* unsolicited event for HP jack sensing */ |
| 14234 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 14235 | unsigned int res) |
| 14236 | { |
| 14237 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14238 | alc262_hippo1_automute( codec ); |
| 14239 | |
| 14240 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14241 | alc662_eeepc_mic_automute(codec); |
| 14242 | } |
| 14243 | |
| 14244 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 14245 | { |
| 14246 | alc262_hippo1_automute( codec ); |
| 14247 | alc662_eeepc_mic_automute(codec); |
| 14248 | } |
| 14249 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14250 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 14251 | { |
| 14252 | unsigned int mute; |
| 14253 | unsigned int present; |
| 14254 | |
| 14255 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 14256 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 14257 | AC_VERB_GET_PIN_SENSE, 0); |
| 14258 | present = (present & 0x80000000) != 0; |
| 14259 | if (present) { |
| 14260 | /* mute internal speaker */ |
| 14261 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 14262 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 14263 | } else { |
| 14264 | /* unmute internal speaker if necessary */ |
| 14265 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 14266 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 14267 | HDA_AMP_MUTE, mute); |
| 14268 | } |
| 14269 | } |
| 14270 | |
| 14271 | /* unsolicited event for HP jack sensing */ |
| 14272 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 14273 | unsigned int res) |
| 14274 | { |
| 14275 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14276 | alc662_eeepc_ep20_automute(codec); |
| 14277 | } |
| 14278 | |
| 14279 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 14280 | { |
| 14281 | alc662_eeepc_ep20_automute(codec); |
| 14282 | } |
| 14283 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14284 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 14285 | { |
| 14286 | unsigned int present; |
| 14287 | unsigned char bits; |
| 14288 | |
| 14289 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 14290 | AC_VERB_GET_PIN_SENSE, 0) |
| 14291 | & AC_PINSENSE_PRESENCE; |
| 14292 | bits = present ? HDA_AMP_MUTE : 0; |
| 14293 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14294 | HDA_AMP_MUTE, bits); |
| 14295 | } |
| 14296 | |
| 14297 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 14298 | { |
| 14299 | unsigned int present; |
| 14300 | |
| 14301 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14302 | AC_VERB_GET_PIN_SENSE, 0) |
| 14303 | & AC_PINSENSE_PRESENCE; |
| 14304 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14305 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 14306 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14307 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 14308 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14309 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
| 14310 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14311 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
| 14312 | } |
| 14313 | |
| 14314 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 14315 | unsigned int res) |
| 14316 | { |
| 14317 | switch (res >> 26) { |
| 14318 | case ALC880_HP_EVENT: |
| 14319 | alc663_m51va_speaker_automute(codec); |
| 14320 | break; |
| 14321 | case ALC880_MIC_EVENT: |
| 14322 | alc663_m51va_mic_automute(codec); |
| 14323 | break; |
| 14324 | } |
| 14325 | } |
| 14326 | |
| 14327 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 14328 | { |
| 14329 | alc663_m51va_speaker_automute(codec); |
| 14330 | alc663_m51va_mic_automute(codec); |
| 14331 | } |
| 14332 | |
| 14333 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 14334 | { |
| 14335 | unsigned int present; |
| 14336 | unsigned char bits; |
| 14337 | |
| 14338 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 14339 | AC_VERB_GET_PIN_SENSE, 0) |
| 14340 | & AC_PINSENSE_PRESENCE; |
| 14341 | bits = present ? HDA_AMP_MUTE : 0; |
| 14342 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14343 | HDA_AMP_MUTE, bits); |
| 14344 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14345 | HDA_AMP_MUTE, bits); |
| 14346 | } |
| 14347 | |
| 14348 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 14349 | { |
| 14350 | unsigned int present; |
| 14351 | unsigned char bits; |
| 14352 | |
| 14353 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14354 | AC_VERB_GET_PIN_SENSE, 0) |
| 14355 | & AC_PINSENSE_PRESENCE; |
| 14356 | bits = present ? HDA_AMP_MUTE : 0; |
| 14357 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14358 | HDA_AMP_MUTE, bits); |
| 14359 | } |
| 14360 | |
| 14361 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 14362 | unsigned int res) |
| 14363 | { |
| 14364 | switch (res >> 26) { |
| 14365 | case ALC880_HP_EVENT: |
| 14366 | alc663_g71v_hp_automute(codec); |
| 14367 | break; |
| 14368 | case ALC880_FRONT_EVENT: |
| 14369 | alc663_g71v_front_automute(codec); |
| 14370 | break; |
| 14371 | case ALC880_MIC_EVENT: |
| 14372 | alc662_eeepc_mic_automute(codec); |
| 14373 | break; |
| 14374 | } |
| 14375 | } |
| 14376 | |
| 14377 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 14378 | { |
| 14379 | alc663_g71v_front_automute(codec); |
| 14380 | alc663_g71v_hp_automute(codec); |
| 14381 | alc662_eeepc_mic_automute(codec); |
| 14382 | } |
| 14383 | |
| 14384 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 14385 | unsigned int res) |
| 14386 | { |
| 14387 | switch (res >> 26) { |
| 14388 | case ALC880_HP_EVENT: |
| 14389 | alc663_m51va_speaker_automute(codec); |
| 14390 | break; |
| 14391 | case ALC880_MIC_EVENT: |
| 14392 | alc662_eeepc_mic_automute(codec); |
| 14393 | break; |
| 14394 | } |
| 14395 | } |
| 14396 | |
| 14397 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 14398 | { |
| 14399 | alc663_m51va_speaker_automute(codec); |
| 14400 | alc662_eeepc_mic_automute(codec); |
| 14401 | } |
| 14402 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14403 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14404 | #define alc662_loopbacks alc880_loopbacks |
| 14405 | #endif |
| 14406 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14407 | |
| 14408 | /* pcm configuration: identiacal with ALC880 */ |
| 14409 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 14410 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 14411 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 14412 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 14413 | |
| 14414 | /* |
| 14415 | * configuration and preset |
| 14416 | */ |
| 14417 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 14418 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 14419 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 14420 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 14421 | [ALC662_5ST_DIG] = "6stack-dig", |
| 14422 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 14423 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14424 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14425 | [ALC663_ASUS_M51VA] = "m51va", |
| 14426 | [ALC663_ASUS_G71V] = "g71v", |
| 14427 | [ALC663_ASUS_H13] = "h13", |
| 14428 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14429 | [ALC662_AUTO] = "auto", |
| 14430 | }; |
| 14431 | |
| 14432 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14433 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V), |
| 14434 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
| 14435 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 14436 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14437 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14438 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14439 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14440 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
| 14441 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
| 14442 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14443 | {} |
| 14444 | }; |
| 14445 | |
| 14446 | static struct alc_config_preset alc662_presets[] = { |
| 14447 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14448 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14449 | .init_verbs = { alc662_init_verbs }, |
| 14450 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14451 | .dac_nids = alc662_dac_nids, |
| 14452 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14453 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14454 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14455 | .channel_mode = alc662_3ST_2ch_modes, |
| 14456 | .input_mux = &alc662_capture_source, |
| 14457 | }, |
| 14458 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14459 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 14460 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14461 | .init_verbs = { alc662_init_verbs }, |
| 14462 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14463 | .dac_nids = alc662_dac_nids, |
| 14464 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14465 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14466 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14467 | .channel_mode = alc662_3ST_6ch_modes, |
| 14468 | .need_dac_fix = 1, |
| 14469 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14470 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14471 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14472 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 14473 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14474 | .init_verbs = { alc662_init_verbs }, |
| 14475 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14476 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14477 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14478 | .channel_mode = alc662_3ST_6ch_modes, |
| 14479 | .need_dac_fix = 1, |
| 14480 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14481 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14482 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14483 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 14484 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14485 | .init_verbs = { alc662_init_verbs }, |
| 14486 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14487 | .dac_nids = alc662_dac_nids, |
| 14488 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14489 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14490 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 14491 | .channel_mode = alc662_5stack_modes, |
| 14492 | .input_mux = &alc662_capture_source, |
| 14493 | }, |
| 14494 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14495 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14496 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 14497 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14498 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14499 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14500 | .channel_mode = alc662_3ST_2ch_modes, |
| 14501 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 14502 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 14503 | .init_hook = alc662_lenovo_101e_all_automute, |
| 14504 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14505 | [ALC662_ASUS_EEEPC_P701] = { |
| 14506 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 14507 | .init_verbs = { alc662_init_verbs, |
| 14508 | alc662_eeepc_sue_init_verbs }, |
| 14509 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14510 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14511 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14512 | .channel_mode = alc662_3ST_2ch_modes, |
| 14513 | .input_mux = &alc662_eeepc_capture_source, |
| 14514 | .unsol_event = alc662_eeepc_unsol_event, |
| 14515 | .init_hook = alc662_eeepc_inithook, |
| 14516 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14517 | [ALC662_ASUS_EEEPC_EP20] = { |
| 14518 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 14519 | alc662_chmode_mixer }, |
| 14520 | .init_verbs = { alc662_init_verbs, |
| 14521 | alc662_eeepc_ep20_sue_init_verbs }, |
| 14522 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14523 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14524 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14525 | .channel_mode = alc662_3ST_6ch_modes, |
| 14526 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 14527 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 14528 | .init_hook = alc662_eeepc_ep20_inithook, |
| 14529 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14530 | [ALC663_ASUS_M51VA] = { |
| 14531 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 14532 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 14533 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14534 | .dac_nids = alc662_dac_nids, |
| 14535 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14536 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14537 | .channel_mode = alc662_3ST_2ch_modes, |
| 14538 | .input_mux = &alc663_m51va_capture_source, |
| 14539 | .unsol_event = alc663_m51va_unsol_event, |
| 14540 | .init_hook = alc663_m51va_inithook, |
| 14541 | }, |
| 14542 | [ALC663_ASUS_G71V] = { |
| 14543 | .mixers = { alc663_g71v_mixer, alc662_capture_mixer}, |
| 14544 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 14545 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14546 | .dac_nids = alc662_dac_nids, |
| 14547 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14548 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14549 | .channel_mode = alc662_3ST_2ch_modes, |
| 14550 | .input_mux = &alc662_eeepc_capture_source, |
| 14551 | .unsol_event = alc663_g71v_unsol_event, |
| 14552 | .init_hook = alc663_g71v_inithook, |
| 14553 | }, |
| 14554 | [ALC663_ASUS_H13] = { |
| 14555 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 14556 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 14557 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14558 | .dac_nids = alc662_dac_nids, |
| 14559 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14560 | .channel_mode = alc662_3ST_2ch_modes, |
| 14561 | .input_mux = &alc663_m51va_capture_source, |
| 14562 | .unsol_event = alc663_m51va_unsol_event, |
| 14563 | .init_hook = alc663_m51va_inithook, |
| 14564 | }, |
| 14565 | [ALC663_ASUS_G50V] = { |
| 14566 | .mixers = { alc663_g50v_mixer, alc662_capture_mixer}, |
| 14567 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 14568 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14569 | .dac_nids = alc662_dac_nids, |
| 14570 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14571 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14572 | .channel_mode = alc662_3ST_6ch_modes, |
| 14573 | .input_mux = &alc663_capture_source, |
| 14574 | .unsol_event = alc663_g50v_unsol_event, |
| 14575 | .init_hook = alc663_g50v_inithook, |
| 14576 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14577 | }; |
| 14578 | |
| 14579 | |
| 14580 | /* |
| 14581 | * BIOS auto configuration |
| 14582 | */ |
| 14583 | |
| 14584 | /* add playback controls from the parsed DAC table */ |
| 14585 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14586 | const struct auto_pin_cfg *cfg) |
| 14587 | { |
| 14588 | char name[32]; |
| 14589 | static const char *chname[4] = { |
| 14590 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14591 | }; |
| 14592 | hda_nid_t nid; |
| 14593 | int i, err; |
| 14594 | |
| 14595 | for (i = 0; i < cfg->line_outs; i++) { |
| 14596 | if (!spec->multiout.dac_nids[i]) |
| 14597 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14598 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14599 | if (i == 2) { |
| 14600 | /* Center/LFE */ |
| 14601 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14602 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14603 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 14604 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14605 | if (err < 0) |
| 14606 | return err; |
| 14607 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14608 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14609 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 14610 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14611 | if (err < 0) |
| 14612 | return err; |
| 14613 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14614 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14615 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 14616 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14617 | if (err < 0) |
| 14618 | return err; |
| 14619 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14620 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14621 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 14622 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14623 | if (err < 0) |
| 14624 | return err; |
| 14625 | } else { |
| 14626 | sprintf(name, "%s Playback Volume", chname[i]); |
| 14627 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14628 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 14629 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14630 | if (err < 0) |
| 14631 | return err; |
| 14632 | sprintf(name, "%s Playback Switch", chname[i]); |
| 14633 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14634 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 14635 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14636 | if (err < 0) |
| 14637 | return err; |
| 14638 | } |
| 14639 | } |
| 14640 | return 0; |
| 14641 | } |
| 14642 | |
| 14643 | /* add playback controls for speaker and HP outputs */ |
| 14644 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 14645 | const char *pfx) |
| 14646 | { |
| 14647 | hda_nid_t nid; |
| 14648 | int err; |
| 14649 | char name[32]; |
| 14650 | |
| 14651 | if (!pin) |
| 14652 | return 0; |
| 14653 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 14654 | if (pin == 0x17) { |
| 14655 | /* ALC663 has a mono output pin on 0x17 */ |
| 14656 | sprintf(name, "%s Playback Switch", pfx); |
| 14657 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14658 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 14659 | return err; |
| 14660 | } |
| 14661 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14662 | if (alc880_is_fixed_pin(pin)) { |
| 14663 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14664 | /* printk("DAC nid=%x\n",nid); */ |
| 14665 | /* specify the DAC as the extra output */ |
| 14666 | if (!spec->multiout.hp_nid) |
| 14667 | spec->multiout.hp_nid = nid; |
| 14668 | else |
| 14669 | spec->multiout.extra_out_nid[0] = nid; |
| 14670 | /* control HP volume/switch on the output mixer amp */ |
| 14671 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14672 | sprintf(name, "%s Playback Volume", pfx); |
| 14673 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14674 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 14675 | if (err < 0) |
| 14676 | return err; |
| 14677 | sprintf(name, "%s Playback Switch", pfx); |
| 14678 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14679 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 14680 | if (err < 0) |
| 14681 | return err; |
| 14682 | } else if (alc880_is_multi_pin(pin)) { |
| 14683 | /* set manual connection */ |
| 14684 | /* we have only a switch on HP-out PIN */ |
| 14685 | sprintf(name, "%s Playback Switch", pfx); |
| 14686 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14687 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14688 | if (err < 0) |
| 14689 | return err; |
| 14690 | } |
| 14691 | return 0; |
| 14692 | } |
| 14693 | |
| 14694 | /* create playback/capture controls for input pins */ |
| 14695 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 14696 | const struct auto_pin_cfg *cfg) |
| 14697 | { |
| 14698 | struct hda_input_mux *imux = &spec->private_imux; |
| 14699 | int i, err, idx; |
| 14700 | |
| 14701 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14702 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 14703 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 14704 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14705 | auto_pin_cfg_labels[i], |
| 14706 | idx, 0x0b); |
| 14707 | if (err < 0) |
| 14708 | return err; |
| 14709 | imux->items[imux->num_items].label = |
| 14710 | auto_pin_cfg_labels[i]; |
| 14711 | imux->items[imux->num_items].index = |
| 14712 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 14713 | imux->num_items++; |
| 14714 | } |
| 14715 | } |
| 14716 | return 0; |
| 14717 | } |
| 14718 | |
| 14719 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14720 | hda_nid_t nid, int pin_type, |
| 14721 | int dac_idx) |
| 14722 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14723 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14724 | /* need the manual connection? */ |
| 14725 | if (alc880_is_multi_pin(nid)) { |
| 14726 | struct alc_spec *spec = codec->spec; |
| 14727 | int idx = alc880_multi_pin_idx(nid); |
| 14728 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 14729 | AC_VERB_SET_CONNECT_SEL, |
| 14730 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 14731 | } |
| 14732 | } |
| 14733 | |
| 14734 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 14735 | { |
| 14736 | struct alc_spec *spec = codec->spec; |
| 14737 | int i; |
| 14738 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14739 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14740 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14741 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14742 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14743 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14744 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14745 | i); |
| 14746 | } |
| 14747 | } |
| 14748 | |
| 14749 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 14750 | { |
| 14751 | struct alc_spec *spec = codec->spec; |
| 14752 | hda_nid_t pin; |
| 14753 | |
| 14754 | pin = spec->autocfg.hp_pins[0]; |
| 14755 | if (pin) /* connect to front */ |
| 14756 | /* use dac 0 */ |
| 14757 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14758 | pin = spec->autocfg.speaker_pins[0]; |
| 14759 | if (pin) |
| 14760 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14761 | } |
| 14762 | |
| 14763 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14764 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 14765 | |
| 14766 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 14767 | { |
| 14768 | struct alc_spec *spec = codec->spec; |
| 14769 | int i; |
| 14770 | |
| 14771 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14772 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14773 | if (alc662_is_input_pin(nid)) { |
| 14774 | snd_hda_codec_write(codec, nid, 0, |
| 14775 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14776 | (i <= AUTO_PIN_FRONT_MIC ? |
| 14777 | PIN_VREF80 : PIN_IN)); |
| 14778 | if (nid != ALC662_PIN_CD_NID) |
| 14779 | snd_hda_codec_write(codec, nid, 0, |
| 14780 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14781 | AMP_OUT_MUTE); |
| 14782 | } |
| 14783 | } |
| 14784 | } |
| 14785 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14786 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 14787 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14788 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 14789 | { |
| 14790 | struct alc_spec *spec = codec->spec; |
| 14791 | int err; |
| 14792 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 14793 | |
| 14794 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14795 | alc662_ignore); |
| 14796 | if (err < 0) |
| 14797 | return err; |
| 14798 | if (!spec->autocfg.line_outs) |
| 14799 | return 0; /* can't find valid BIOS pin config */ |
| 14800 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14801 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14802 | if (err < 0) |
| 14803 | return err; |
| 14804 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14805 | if (err < 0) |
| 14806 | return err; |
| 14807 | err = alc662_auto_create_extra_out(spec, |
| 14808 | spec->autocfg.speaker_pins[0], |
| 14809 | "Speaker"); |
| 14810 | if (err < 0) |
| 14811 | return err; |
| 14812 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 14813 | "Headphone"); |
| 14814 | if (err < 0) |
| 14815 | return err; |
| 14816 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14817 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14818 | return err; |
| 14819 | |
| 14820 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14821 | |
| 14822 | if (spec->autocfg.dig_out_pin) |
| 14823 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 14824 | |
| 14825 | if (spec->kctl_alloc) |
| 14826 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 14827 | |
| 14828 | spec->num_mux_defs = 1; |
| 14829 | spec->input_mux = &spec->private_imux; |
| 14830 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14831 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 14832 | if (codec->vendor_id == 0x10ec0663) |
| 14833 | spec->init_verbs[spec->num_init_verbs++] = |
| 14834 | alc663_auto_init_verbs; |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 14835 | |
| 14836 | err = alc_auto_add_mic_boost(codec); |
| 14837 | if (err < 0) |
| 14838 | return err; |
| 14839 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14840 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 14841 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14842 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14843 | } |
| 14844 | |
| 14845 | /* additional initialization for auto-configuration model */ |
| 14846 | static void alc662_auto_init(struct hda_codec *codec) |
| 14847 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14848 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14849 | alc662_auto_init_multi_out(codec); |
| 14850 | alc662_auto_init_hp_out(codec); |
| 14851 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14852 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14853 | if (spec->unsol_event) |
| 14854 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14855 | } |
| 14856 | |
| 14857 | static int patch_alc662(struct hda_codec *codec) |
| 14858 | { |
| 14859 | struct alc_spec *spec; |
| 14860 | int err, board_config; |
| 14861 | |
| 14862 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14863 | if (!spec) |
| 14864 | return -ENOMEM; |
| 14865 | |
| 14866 | codec->spec = spec; |
| 14867 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 14868 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 14869 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14870 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 14871 | alc662_models, |
| 14872 | alc662_cfg_tbl); |
| 14873 | if (board_config < 0) { |
| 14874 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 14875 | "trying auto-probe from BIOS...\n"); |
| 14876 | board_config = ALC662_AUTO; |
| 14877 | } |
| 14878 | |
| 14879 | if (board_config == ALC662_AUTO) { |
| 14880 | /* automatic parse from the BIOS config */ |
| 14881 | err = alc662_parse_auto_config(codec); |
| 14882 | if (err < 0) { |
| 14883 | alc_free(codec); |
| 14884 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14885 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14886 | printk(KERN_INFO |
| 14887 | "hda_codec: Cannot set up configuration " |
| 14888 | "from BIOS. Using base mode...\n"); |
| 14889 | board_config = ALC662_3ST_2ch_DIG; |
| 14890 | } |
| 14891 | } |
| 14892 | |
| 14893 | if (board_config != ALC662_AUTO) |
| 14894 | setup_preset(spec, &alc662_presets[board_config]); |
| 14895 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14896 | if (codec->vendor_id == 0x10ec0663) { |
| 14897 | spec->stream_name_analog = "ALC663 Analog"; |
| 14898 | spec->stream_name_digital = "ALC663 Digital"; |
| 14899 | } else { |
| 14900 | spec->stream_name_analog = "ALC662 Analog"; |
| 14901 | spec->stream_name_digital = "ALC662 Digital"; |
| 14902 | } |
| 14903 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14904 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 14905 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 14906 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14907 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 14908 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 14909 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14910 | spec->adc_nids = alc662_adc_nids; |
| 14911 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 14912 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14913 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14914 | spec->vmaster_nid = 0x02; |
| 14915 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14916 | codec->patch_ops = alc_patch_ops; |
| 14917 | if (board_config == ALC662_AUTO) |
| 14918 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14919 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14920 | if (!spec->loopback.amplist) |
| 14921 | spec->loopback.amplist = alc662_loopbacks; |
| 14922 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14923 | |
| 14924 | return 0; |
| 14925 | } |
| 14926 | |
| 14927 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14928 | * patch entries |
| 14929 | */ |
| 14930 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 14931 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14932 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14933 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14934 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14935 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14936 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14937 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14938 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 14939 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 14940 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14941 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 14942 | .patch = patch_alc883 }, |
| 14943 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 14944 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14945 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14946 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14947 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14948 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 14949 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 14950 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14951 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14952 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14953 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14954 | {} /* terminator */ |
| 14955 | }; |