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 | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 81 | #ifdef CONFIG_SND_DEBUG |
| 82 | ALC260_TEST, |
| 83 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 84 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 85 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | }; |
| 87 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 88 | /* ALC262 models */ |
| 89 | enum { |
| 90 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 91 | ALC262_HIPPO, |
| 92 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 93 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 94 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 95 | ALC262_HP_BPC_D7000_WL, |
| 96 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 97 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 98 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 99 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 100 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 101 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 102 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 103 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 104 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 105 | ALC262_TOSHIBA_S06, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 106 | ALC262_AUTO, |
| 107 | ALC262_MODEL_LAST /* last tag */ |
| 108 | }; |
| 109 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 110 | /* ALC268 models */ |
| 111 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 112 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 114 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 115 | ALC268_ACER, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame^] | 116 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 117 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 118 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 119 | #ifdef CONFIG_SND_DEBUG |
| 120 | ALC268_TEST, |
| 121 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 122 | ALC268_AUTO, |
| 123 | ALC268_MODEL_LAST /* last tag */ |
| 124 | }; |
| 125 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 126 | /* ALC269 models */ |
| 127 | enum { |
| 128 | ALC269_BASIC, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 129 | ALC269_ASUS_EEEPC_P703, |
| 130 | ALC269_ASUS_EEEPC_P901, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 131 | ALC269_AUTO, |
| 132 | ALC269_MODEL_LAST /* last tag */ |
| 133 | }; |
| 134 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 135 | /* ALC861 models */ |
| 136 | enum { |
| 137 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 138 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 139 | ALC861_3ST_DIG, |
| 140 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 141 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 142 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 143 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 144 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 145 | ALC861_AUTO, |
| 146 | ALC861_MODEL_LAST, |
| 147 | }; |
| 148 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 149 | /* ALC861-VD models */ |
| 150 | enum { |
| 151 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 152 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 153 | ALC861VD_3ST, |
| 154 | ALC861VD_3ST_DIG, |
| 155 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 156 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 157 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 158 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 159 | ALC861VD_AUTO, |
| 160 | ALC861VD_MODEL_LAST, |
| 161 | }; |
| 162 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 163 | /* ALC662 models */ |
| 164 | enum { |
| 165 | ALC662_3ST_2ch_DIG, |
| 166 | ALC662_3ST_6ch_DIG, |
| 167 | ALC662_3ST_6ch, |
| 168 | ALC662_5ST_DIG, |
| 169 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 170 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 171 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 172 | ALC663_ASUS_M51VA, |
| 173 | ALC663_ASUS_G71V, |
| 174 | ALC663_ASUS_H13, |
| 175 | ALC663_ASUS_G50V, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 176 | ALC662_AUTO, |
| 177 | ALC662_MODEL_LAST, |
| 178 | }; |
| 179 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 180 | /* ALC882 models */ |
| 181 | enum { |
| 182 | ALC882_3ST_DIG, |
| 183 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 184 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 185 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 186 | ALC882_TARGA, |
| 187 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 188 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 189 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 190 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 191 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 192 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 193 | ALC882_MODEL_LAST, |
| 194 | }; |
| 195 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 196 | /* ALC883 models */ |
| 197 | enum { |
| 198 | ALC883_3ST_2ch_DIG, |
| 199 | ALC883_3ST_6ch_DIG, |
| 200 | ALC883_3ST_6ch, |
| 201 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 202 | ALC883_TARGA_DIG, |
| 203 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 204 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 205 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 206 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 207 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 208 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 209 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 210 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 211 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 212 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 213 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 214 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 215 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 216 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 217 | ALC883_FUJITSU_PI2515, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 218 | ALC883_3ST_6ch_INTEL, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 219 | ALC883_AUTO, |
| 220 | ALC883_MODEL_LAST, |
| 221 | }; |
| 222 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 223 | /* for GPIO Poll */ |
| 224 | #define GPIO_MASK 0x03 |
| 225 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | struct alc_spec { |
| 227 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 228 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | unsigned int num_mixers; |
| 230 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 231 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 232 | * don't forget NULL |
| 233 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 234 | */ |
| 235 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 237 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | struct hda_pcm_stream *stream_analog_playback; |
| 239 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 240 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 241 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 243 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | struct hda_pcm_stream *stream_digital_playback; |
| 245 | struct hda_pcm_stream *stream_digital_capture; |
| 246 | |
| 247 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 248 | struct hda_multi_out multiout; /* playback set-up |
| 249 | * max_channels, dacs must be set |
| 250 | * dig_out_nid and hp_nid are optional |
| 251 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 252 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | |
| 254 | /* capture */ |
| 255 | unsigned int num_adc_nids; |
| 256 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 257 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 258 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | |
| 260 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 261 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | const struct hda_input_mux *input_mux; |
| 263 | unsigned int cur_mux[3]; |
| 264 | |
| 265 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 266 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 268 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | |
| 270 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 271 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 272 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 273 | /* dynamic controls, init_verbs and input_mux */ |
| 274 | struct auto_pin_cfg autocfg; |
| 275 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 276 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 277 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 278 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 279 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 280 | /* hooks */ |
| 281 | void (*init_hook)(struct hda_codec *codec); |
| 282 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 283 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 284 | /* for pin sensing */ |
| 285 | unsigned int sense_updated: 1; |
| 286 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 287 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 288 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 289 | /* for virtual master */ |
| 290 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 291 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 292 | struct hda_loopback_check loopback; |
| 293 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 294 | |
| 295 | /* for PLL fix */ |
| 296 | hda_nid_t pll_nid; |
| 297 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 298 | }; |
| 299 | |
| 300 | /* |
| 301 | * configuration template - to be copied to the spec instance |
| 302 | */ |
| 303 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 304 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 305 | * with spec |
| 306 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 307 | const struct hda_verb *init_verbs[5]; |
| 308 | unsigned int num_dacs; |
| 309 | hda_nid_t *dac_nids; |
| 310 | hda_nid_t dig_out_nid; /* optional */ |
| 311 | hda_nid_t hp_nid; /* optional */ |
| 312 | unsigned int num_adc_nids; |
| 313 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 314 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 315 | hda_nid_t dig_in_nid; |
| 316 | unsigned int num_channel_mode; |
| 317 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 318 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 319 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 320 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 321 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 322 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 323 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 324 | struct hda_amp_list *loopbacks; |
| 325 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | }; |
| 327 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | |
| 329 | /* |
| 330 | * input MUX handling |
| 331 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 332 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 333 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | { |
| 335 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 336 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 337 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 338 | if (mux_idx >= spec->num_mux_defs) |
| 339 | mux_idx = 0; |
| 340 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | } |
| 342 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 343 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 344 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | { |
| 346 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 347 | struct alc_spec *spec = codec->spec; |
| 348 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 349 | |
| 350 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 351 | return 0; |
| 352 | } |
| 353 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 354 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 355 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | { |
| 357 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 358 | struct alc_spec *spec = codec->spec; |
| 359 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 360 | 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] | 361 | hda_nid_t nid = spec->capsrc_nids ? |
| 362 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 363 | 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] | 364 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | } |
| 366 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 367 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | /* |
| 369 | * channel mode setting |
| 370 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 371 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 372 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | { |
| 374 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 375 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 376 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 377 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | } |
| 379 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 380 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 381 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 382 | { |
| 383 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 384 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 385 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 386 | spec->num_channel_mode, |
| 387 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | } |
| 389 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 390 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 391 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | { |
| 393 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 394 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 395 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 396 | spec->num_channel_mode, |
| 397 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 398 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 399 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 400 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | } |
| 402 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 404 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 405 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 406 | * being part of a format specifier. Maximum allowed length of a value is |
| 407 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 408 | * |
| 409 | * Note: some retasking pin complexes seem to ignore requests for input |
| 410 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 411 | * are requested. Therefore order this list so that this behaviour will not |
| 412 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 413 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 414 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 415 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 416 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 417 | "Mic 50pc bias", "Mic 80pc bias", |
| 418 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 419 | }; |
| 420 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 421 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 422 | }; |
| 423 | /* 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] | 424 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 425 | * addition, "input" pins may or may not process the mic bias option |
| 426 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 427 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 428 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 429 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 430 | #define ALC_PIN_DIR_IN 0x00 |
| 431 | #define ALC_PIN_DIR_OUT 0x01 |
| 432 | #define ALC_PIN_DIR_INOUT 0x02 |
| 433 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 434 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 435 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 436 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 437 | * For each direction the minimum and maximum values are given. |
| 438 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 439 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 440 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 441 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 442 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 443 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 444 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 445 | }; |
| 446 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 447 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 448 | #define alc_pin_mode_n_items(_dir) \ |
| 449 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 450 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 451 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 452 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 453 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 454 | unsigned int item_num = uinfo->value.enumerated.item; |
| 455 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 456 | |
| 457 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 458 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 459 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 460 | |
| 461 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 462 | item_num = alc_pin_mode_min(dir); |
| 463 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 464 | return 0; |
| 465 | } |
| 466 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 467 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 468 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 469 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 470 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 471 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 472 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 473 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 474 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 475 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 476 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 477 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 478 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 479 | /* Find enumerated value for current pinctl setting */ |
| 480 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 481 | 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] | 482 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 483 | *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] | 484 | return 0; |
| 485 | } |
| 486 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 487 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 488 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 489 | { |
| 490 | signed int change; |
| 491 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 492 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 493 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 494 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 495 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 496 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 497 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 498 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 499 | 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] | 500 | val = alc_pin_mode_min(dir); |
| 501 | |
| 502 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 503 | if (change) { |
| 504 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 505 | snd_hda_codec_write_cache(codec, nid, 0, |
| 506 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 507 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 508 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 509 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 510 | * for the requested pin mode. Enum values of 2 or less are |
| 511 | * input modes. |
| 512 | * |
| 513 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 514 | * reduces noise slightly (particularly on input) so we'll |
| 515 | * do it. However, having both input and output buffers |
| 516 | * enabled simultaneously doesn't seem to be problematic if |
| 517 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 518 | */ |
| 519 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 520 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 521 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 522 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 523 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 524 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 525 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 526 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 527 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 528 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 529 | } |
| 530 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 531 | return change; |
| 532 | } |
| 533 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 534 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 535 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 536 | .info = alc_pin_mode_info, \ |
| 537 | .get = alc_pin_mode_get, \ |
| 538 | .put = alc_pin_mode_put, \ |
| 539 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 540 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 541 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 542 | * together using a mask with more than one bit set. This control is |
| 543 | * currently used only by the ALC260 test model. At this stage they are not |
| 544 | * needed for any "production" models. |
| 545 | */ |
| 546 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 547 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 548 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 549 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 550 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 551 | { |
| 552 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 553 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 554 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 555 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 556 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 557 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 558 | |
| 559 | *valp = (val & mask) != 0; |
| 560 | return 0; |
| 561 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 562 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 563 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 564 | { |
| 565 | signed int change; |
| 566 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 567 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 568 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 569 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 570 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 571 | AC_VERB_GET_GPIO_DATA, |
| 572 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 573 | |
| 574 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 575 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 576 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 577 | gpio_data &= ~mask; |
| 578 | else |
| 579 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 580 | snd_hda_codec_write_cache(codec, nid, 0, |
| 581 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 582 | |
| 583 | return change; |
| 584 | } |
| 585 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 586 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 587 | .info = alc_gpio_data_info, \ |
| 588 | .get = alc_gpio_data_get, \ |
| 589 | .put = alc_gpio_data_put, \ |
| 590 | .private_value = nid | (mask<<16) } |
| 591 | #endif /* CONFIG_SND_DEBUG */ |
| 592 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 593 | /* A switch control to allow the enabling of the digital IO pins on the |
| 594 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 595 | * to provide something in the test model allowing digital outputs to be |
| 596 | * identified if present. If models are found which can utilise these |
| 597 | * outputs a more complete mixer control can be devised for those models if |
| 598 | * necessary. |
| 599 | */ |
| 600 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 601 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 602 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 603 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 604 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 605 | { |
| 606 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 607 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 608 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 609 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 610 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 611 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 612 | |
| 613 | *valp = (val & mask) != 0; |
| 614 | return 0; |
| 615 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 616 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 617 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 618 | { |
| 619 | signed int change; |
| 620 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 621 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 622 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 623 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 624 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 625 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 626 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 627 | |
| 628 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 629 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 630 | if (val==0) |
| 631 | ctrl_data &= ~mask; |
| 632 | else |
| 633 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 634 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 635 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 636 | |
| 637 | return change; |
| 638 | } |
| 639 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 640 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 641 | .info = alc_spdif_ctrl_info, \ |
| 642 | .get = alc_spdif_ctrl_get, \ |
| 643 | .put = alc_spdif_ctrl_put, \ |
| 644 | .private_value = nid | (mask<<16) } |
| 645 | #endif /* CONFIG_SND_DEBUG */ |
| 646 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 647 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 648 | * Again, this is only used in the ALC26x test models to help identify when |
| 649 | * the EAPD line must be asserted for features to work. |
| 650 | */ |
| 651 | #ifdef CONFIG_SND_DEBUG |
| 652 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 653 | |
| 654 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 655 | struct snd_ctl_elem_value *ucontrol) |
| 656 | { |
| 657 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 658 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 659 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 660 | long *valp = ucontrol->value.integer.value; |
| 661 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 662 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 663 | |
| 664 | *valp = (val & mask) != 0; |
| 665 | return 0; |
| 666 | } |
| 667 | |
| 668 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 669 | struct snd_ctl_elem_value *ucontrol) |
| 670 | { |
| 671 | int change; |
| 672 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 673 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 674 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 675 | long val = *ucontrol->value.integer.value; |
| 676 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 677 | AC_VERB_GET_EAPD_BTLENABLE, |
| 678 | 0x00); |
| 679 | |
| 680 | /* Set/unset the masked control bit(s) as needed */ |
| 681 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 682 | if (!val) |
| 683 | ctrl_data &= ~mask; |
| 684 | else |
| 685 | ctrl_data |= mask; |
| 686 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 687 | ctrl_data); |
| 688 | |
| 689 | return change; |
| 690 | } |
| 691 | |
| 692 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 693 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 694 | .info = alc_eapd_ctrl_info, \ |
| 695 | .get = alc_eapd_ctrl_get, \ |
| 696 | .put = alc_eapd_ctrl_put, \ |
| 697 | .private_value = nid | (mask<<16) } |
| 698 | #endif /* CONFIG_SND_DEBUG */ |
| 699 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 700 | /* |
| 701 | * set up from the preset table |
| 702 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 703 | static void setup_preset(struct alc_spec *spec, |
| 704 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 705 | { |
| 706 | int i; |
| 707 | |
| 708 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 709 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 710 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 711 | i++) |
| 712 | spec->init_verbs[spec->num_init_verbs++] = |
| 713 | preset->init_verbs[i]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 714 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 715 | spec->channel_mode = preset->channel_mode; |
| 716 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 717 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 718 | |
| 719 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 720 | |
| 721 | spec->multiout.num_dacs = preset->num_dacs; |
| 722 | spec->multiout.dac_nids = preset->dac_nids; |
| 723 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 724 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 725 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 726 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 727 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 728 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 729 | spec->input_mux = preset->input_mux; |
| 730 | |
| 731 | spec->num_adc_nids = preset->num_adc_nids; |
| 732 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 733 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 734 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 735 | |
| 736 | spec->unsol_event = preset->unsol_event; |
| 737 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 738 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 739 | spec->loopback.amplist = preset->loopbacks; |
| 740 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 741 | } |
| 742 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 743 | /* Enable GPIO mask and set output */ |
| 744 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 745 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 746 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 747 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 748 | { } |
| 749 | }; |
| 750 | |
| 751 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 752 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 753 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 754 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 755 | { } |
| 756 | }; |
| 757 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 758 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 759 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 760 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 761 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 762 | { } |
| 763 | }; |
| 764 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 765 | /* |
| 766 | * Fix hardware PLL issue |
| 767 | * On some codecs, the analog PLL gating control must be off while |
| 768 | * the default value is 1. |
| 769 | */ |
| 770 | static void alc_fix_pll(struct hda_codec *codec) |
| 771 | { |
| 772 | struct alc_spec *spec = codec->spec; |
| 773 | unsigned int val; |
| 774 | |
| 775 | if (!spec->pll_nid) |
| 776 | return; |
| 777 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 778 | spec->pll_coef_idx); |
| 779 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 780 | AC_VERB_GET_PROC_COEF, 0); |
| 781 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 782 | spec->pll_coef_idx); |
| 783 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 784 | val & ~(1 << spec->pll_coef_bit)); |
| 785 | } |
| 786 | |
| 787 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 788 | unsigned int coef_idx, unsigned int coef_bit) |
| 789 | { |
| 790 | struct alc_spec *spec = codec->spec; |
| 791 | spec->pll_nid = nid; |
| 792 | spec->pll_coef_idx = coef_idx; |
| 793 | spec->pll_coef_bit = coef_bit; |
| 794 | alc_fix_pll(codec); |
| 795 | } |
| 796 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 797 | static void alc_sku_automute(struct hda_codec *codec) |
| 798 | { |
| 799 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 800 | unsigned int present; |
| 801 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 802 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 803 | |
| 804 | /* need to execute and sync at first */ |
| 805 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 806 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 807 | AC_VERB_GET_PIN_SENSE, 0); |
| 808 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 809 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 810 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 811 | } |
| 812 | |
| 813 | /* unsolicited event for HP jack sensing */ |
| 814 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 815 | { |
| 816 | if (codec->vendor_id == 0x10ec0880) |
| 817 | res >>= 28; |
| 818 | else |
| 819 | res >>= 26; |
| 820 | if (res != ALC880_HP_EVENT) |
| 821 | return; |
| 822 | |
| 823 | alc_sku_automute(codec); |
| 824 | } |
| 825 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 826 | /* additional initialization for ALC888 variants */ |
| 827 | static void alc888_coef_init(struct hda_codec *codec) |
| 828 | { |
| 829 | unsigned int tmp; |
| 830 | |
| 831 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 832 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 833 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 834 | if ((tmp & 0xf0) == 2) |
| 835 | /* alc888S-VC */ |
| 836 | snd_hda_codec_read(codec, 0x20, 0, |
| 837 | AC_VERB_SET_PROC_COEF, 0x830); |
| 838 | else |
| 839 | /* alc888-VB */ |
| 840 | snd_hda_codec_read(codec, 0x20, 0, |
| 841 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 842 | } |
| 843 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 844 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 845 | * 31 ~ 16 : Manufacture ID |
| 846 | * 15 ~ 8 : SKU ID |
| 847 | * 7 ~ 0 : Assembly ID |
| 848 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 849 | */ |
| 850 | static void alc_subsystem_id(struct hda_codec *codec, |
| 851 | unsigned int porta, unsigned int porte, |
| 852 | unsigned int portd) |
| 853 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 854 | unsigned int ass, tmp, i; |
| 855 | unsigned nid; |
| 856 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 857 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 858 | ass = codec->subsystem_id & 0xffff; |
| 859 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 860 | goto do_sku; |
| 861 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 862 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 863 | * 31~30 : port conetcivity |
| 864 | * 29~21 : reserve |
| 865 | * 20 : PCBEEP input |
| 866 | * 19~16 : Check sum (15:1) |
| 867 | * 15~1 : Custom |
| 868 | * 0 : override |
| 869 | */ |
| 870 | nid = 0x1d; |
| 871 | if (codec->vendor_id == 0x10ec0260) |
| 872 | nid = 0x17; |
| 873 | ass = snd_hda_codec_read(codec, nid, 0, |
| 874 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 875 | if (!(ass & 1) && !(ass & 0x100000)) |
| 876 | return; |
| 877 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 878 | return; |
| 879 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 880 | /* check sum */ |
| 881 | tmp = 0; |
| 882 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 883 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 884 | tmp++; |
| 885 | } |
| 886 | if (((ass >> 16) & 0xf) != tmp) |
| 887 | return; |
| 888 | do_sku: |
| 889 | /* |
| 890 | * 0 : override |
| 891 | * 1 : Swap Jack |
| 892 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 893 | * 3~5 : External Amplifier control |
| 894 | * 7~6 : Reserved |
| 895 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 896 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 897 | switch (tmp) { |
| 898 | case 1: |
| 899 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 900 | break; |
| 901 | case 3: |
| 902 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 903 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 904 | case 7: |
| 905 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 906 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 907 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 908 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 909 | case 0x10ec0260: |
| 910 | snd_hda_codec_write(codec, 0x0f, 0, |
| 911 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 912 | snd_hda_codec_write(codec, 0x10, 0, |
| 913 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 914 | break; |
| 915 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 916 | case 0x10ec0267: |
| 917 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 918 | case 0x10ec0269: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 919 | case 0x10ec0660: |
| 920 | case 0x10ec0662: |
| 921 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 922 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 923 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 924 | snd_hda_codec_write(codec, 0x14, 0, |
| 925 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 926 | snd_hda_codec_write(codec, 0x15, 0, |
| 927 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 928 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 929 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 930 | switch (codec->vendor_id) { |
| 931 | case 0x10ec0260: |
| 932 | snd_hda_codec_write(codec, 0x1a, 0, |
| 933 | AC_VERB_SET_COEF_INDEX, 7); |
| 934 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 935 | AC_VERB_GET_PROC_COEF, 0); |
| 936 | snd_hda_codec_write(codec, 0x1a, 0, |
| 937 | AC_VERB_SET_COEF_INDEX, 7); |
| 938 | snd_hda_codec_write(codec, 0x1a, 0, |
| 939 | AC_VERB_SET_PROC_COEF, |
| 940 | tmp | 0x2010); |
| 941 | break; |
| 942 | case 0x10ec0262: |
| 943 | case 0x10ec0880: |
| 944 | case 0x10ec0882: |
| 945 | case 0x10ec0883: |
| 946 | case 0x10ec0885: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 947 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 948 | snd_hda_codec_write(codec, 0x20, 0, |
| 949 | AC_VERB_SET_COEF_INDEX, 7); |
| 950 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 951 | AC_VERB_GET_PROC_COEF, 0); |
| 952 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 953 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 954 | snd_hda_codec_write(codec, 0x20, 0, |
| 955 | AC_VERB_SET_PROC_COEF, |
| 956 | tmp | 0x2010); |
| 957 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 958 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 959 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 960 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 961 | case 0x10ec0267: |
| 962 | case 0x10ec0268: |
| 963 | snd_hda_codec_write(codec, 0x20, 0, |
| 964 | AC_VERB_SET_COEF_INDEX, 7); |
| 965 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 966 | AC_VERB_GET_PROC_COEF, 0); |
| 967 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 968 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 969 | snd_hda_codec_write(codec, 0x20, 0, |
| 970 | AC_VERB_SET_PROC_COEF, |
| 971 | tmp | 0x3000); |
| 972 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 973 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 974 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 975 | break; |
| 976 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 977 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 978 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 979 | * when the external headphone out jack is plugged" |
| 980 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 981 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 982 | return; |
| 983 | /* |
| 984 | * 10~8 : Jack location |
| 985 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 986 | * 14~13: Resvered |
| 987 | * 15 : 1 --> enable the function "Mute internal speaker |
| 988 | * when the external headphone out jack is plugged" |
| 989 | */ |
| 990 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 991 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 992 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 993 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 994 | else |
| 995 | return; |
| 996 | } |
| 997 | |
| 998 | if (!spec->autocfg.hp_pins[0]) { |
| 999 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1000 | if (tmp == 0) |
| 1001 | spec->autocfg.hp_pins[0] = porta; |
| 1002 | else if (tmp == 1) |
| 1003 | spec->autocfg.hp_pins[0] = porte; |
| 1004 | else if (tmp == 2) |
| 1005 | spec->autocfg.hp_pins[0] = portd; |
| 1006 | else |
| 1007 | return; |
| 1008 | } |
| 1009 | |
| 1010 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1011 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1012 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1013 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1014 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1015 | } |
| 1016 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1017 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1018 | * Fix-up pin default configurations |
| 1019 | */ |
| 1020 | |
| 1021 | struct alc_pincfg { |
| 1022 | hda_nid_t nid; |
| 1023 | u32 val; |
| 1024 | }; |
| 1025 | |
| 1026 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1027 | const struct snd_pci_quirk *quirk, |
| 1028 | const struct alc_pincfg **pinfix) |
| 1029 | { |
| 1030 | const struct alc_pincfg *cfg; |
| 1031 | |
| 1032 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1033 | if (!quirk) |
| 1034 | return; |
| 1035 | |
| 1036 | cfg = pinfix[quirk->value]; |
| 1037 | for (; cfg->nid; cfg++) { |
| 1038 | int i; |
| 1039 | u32 val = cfg->val; |
| 1040 | for (i = 0; i < 4; i++) { |
| 1041 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1042 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1043 | val & 0xff); |
| 1044 | val >>= 8; |
| 1045 | } |
| 1046 | } |
| 1047 | } |
| 1048 | |
| 1049 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1050 | * ALC880 3-stack model |
| 1051 | * |
| 1052 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1053 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1054 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1055 | */ |
| 1056 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1057 | static hda_nid_t alc880_dac_nids[4] = { |
| 1058 | /* front, rear, clfe, rear_surr */ |
| 1059 | 0x02, 0x05, 0x04, 0x03 |
| 1060 | }; |
| 1061 | |
| 1062 | static hda_nid_t alc880_adc_nids[3] = { |
| 1063 | /* ADC0-2 */ |
| 1064 | 0x07, 0x08, 0x09, |
| 1065 | }; |
| 1066 | |
| 1067 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1068 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1069 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1070 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1071 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1072 | /* ADC1-2 */ |
| 1073 | 0x08, 0x09, |
| 1074 | }; |
| 1075 | |
| 1076 | #define ALC880_DIGOUT_NID 0x06 |
| 1077 | #define ALC880_DIGIN_NID 0x0a |
| 1078 | |
| 1079 | static struct hda_input_mux alc880_capture_source = { |
| 1080 | .num_items = 4, |
| 1081 | .items = { |
| 1082 | { "Mic", 0x0 }, |
| 1083 | { "Front Mic", 0x3 }, |
| 1084 | { "Line", 0x2 }, |
| 1085 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1086 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1087 | }; |
| 1088 | |
| 1089 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1090 | /* 2ch mode */ |
| 1091 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1092 | /* set line-in to input, mute it */ |
| 1093 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1094 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1095 | /* set mic-in to input vref 80%, mute it */ |
| 1096 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1097 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1098 | { } /* end */ |
| 1099 | }; |
| 1100 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1101 | /* 6ch mode */ |
| 1102 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1103 | /* set line-in to output, unmute it */ |
| 1104 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1105 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1106 | /* set mic-in to output, unmute it */ |
| 1107 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1108 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1109 | { } /* end */ |
| 1110 | }; |
| 1111 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1112 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1113 | { 2, alc880_threestack_ch2_init }, |
| 1114 | { 6, alc880_threestack_ch6_init }, |
| 1115 | }; |
| 1116 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1117 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1118 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1119 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1120 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1121 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1122 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1123 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1124 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1125 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1126 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1127 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1128 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1129 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1130 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1131 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1132 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1133 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1134 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1135 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1136 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1137 | { |
| 1138 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1139 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1140 | .info = alc_ch_mode_info, |
| 1141 | .get = alc_ch_mode_get, |
| 1142 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1143 | }, |
| 1144 | { } /* end */ |
| 1145 | }; |
| 1146 | |
| 1147 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1148 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1149 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1150 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1151 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1152 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1153 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1154 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1155 | { |
| 1156 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1157 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1158 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1159 | */ |
| 1160 | /* .name = "Capture Source", */ |
| 1161 | .name = "Input Source", |
| 1162 | .count = 3, |
| 1163 | .info = alc_mux_enum_info, |
| 1164 | .get = alc_mux_enum_get, |
| 1165 | .put = alc_mux_enum_put, |
| 1166 | }, |
| 1167 | { } /* end */ |
| 1168 | }; |
| 1169 | |
| 1170 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1171 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1172 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1173 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1174 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1175 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1176 | { |
| 1177 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1178 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1179 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1180 | */ |
| 1181 | /* .name = "Capture Source", */ |
| 1182 | .name = "Input Source", |
| 1183 | .count = 2, |
| 1184 | .info = alc_mux_enum_info, |
| 1185 | .get = alc_mux_enum_get, |
| 1186 | .put = alc_mux_enum_put, |
| 1187 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1188 | { } /* end */ |
| 1189 | }; |
| 1190 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1191 | |
| 1192 | |
| 1193 | /* |
| 1194 | * ALC880 5-stack model |
| 1195 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1196 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1197 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1198 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1199 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1200 | */ |
| 1201 | |
| 1202 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1203 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1204 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1205 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1206 | { } /* end */ |
| 1207 | }; |
| 1208 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1209 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1210 | /* 6ch mode */ |
| 1211 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1212 | /* set line-in to input, mute it */ |
| 1213 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1214 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1215 | { } /* end */ |
| 1216 | }; |
| 1217 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1218 | /* 8ch mode */ |
| 1219 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1220 | /* set line-in to output, unmute it */ |
| 1221 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1222 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1223 | { } /* end */ |
| 1224 | }; |
| 1225 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1226 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1227 | { 6, alc880_fivestack_ch6_init }, |
| 1228 | { 8, alc880_fivestack_ch8_init }, |
| 1229 | }; |
| 1230 | |
| 1231 | |
| 1232 | /* |
| 1233 | * ALC880 6-stack model |
| 1234 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1235 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1236 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1237 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1238 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1239 | */ |
| 1240 | |
| 1241 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1242 | /* front, rear, clfe, rear_surr */ |
| 1243 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1244 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1245 | |
| 1246 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1247 | .num_items = 4, |
| 1248 | .items = { |
| 1249 | { "Mic", 0x0 }, |
| 1250 | { "Front Mic", 0x1 }, |
| 1251 | { "Line", 0x2 }, |
| 1252 | { "CD", 0x4 }, |
| 1253 | }, |
| 1254 | }; |
| 1255 | |
| 1256 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1257 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1258 | { 8, NULL }, |
| 1259 | }; |
| 1260 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1261 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1262 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1263 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1264 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1265 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1266 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1267 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1268 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1269 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1270 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1271 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1272 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1273 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1274 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1275 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1276 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1277 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1278 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1279 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1280 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1281 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1282 | { |
| 1283 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1284 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1285 | .info = alc_ch_mode_info, |
| 1286 | .get = alc_ch_mode_get, |
| 1287 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1288 | }, |
| 1289 | { } /* end */ |
| 1290 | }; |
| 1291 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1292 | |
| 1293 | /* |
| 1294 | * ALC880 W810 model |
| 1295 | * |
| 1296 | * W810 has rear IO for: |
| 1297 | * Front (DAC 02) |
| 1298 | * Surround (DAC 03) |
| 1299 | * Center/LFE (DAC 04) |
| 1300 | * Digital out (06) |
| 1301 | * |
| 1302 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1303 | * These are both connected to Line2 on the codec, hence to DAC 02. |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1304 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1305 | * There is a variable resistor to control the speaker or headphone |
| 1306 | * volume. This is a hardware-only device without a software API. |
| 1307 | * |
| 1308 | * Plugging headphones in will disable the internal speakers. This is |
| 1309 | * implemented in hardware, not via the driver using jack sense. In |
| 1310 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1311 | * disable both the speakers and headphones. |
| 1312 | * |
| 1313 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1314 | * These may not do anything useful with this driver yet, because I |
| 1315 | * haven't setup any initialization verbs for these yet... |
| 1316 | */ |
| 1317 | |
| 1318 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1319 | /* front, rear/surround, clfe */ |
| 1320 | 0x02, 0x03, 0x04 |
| 1321 | }; |
| 1322 | |
| 1323 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1324 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1325 | { 6, NULL } |
| 1326 | }; |
| 1327 | |
| 1328 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1329 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1330 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1331 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1332 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1333 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1334 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1335 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1336 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1337 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1338 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1339 | { } /* end */ |
| 1340 | }; |
| 1341 | |
| 1342 | |
| 1343 | /* |
| 1344 | * Z710V model |
| 1345 | * |
| 1346 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1347 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1348 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1349 | */ |
| 1350 | |
| 1351 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1352 | 0x02 |
| 1353 | }; |
| 1354 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1355 | |
| 1356 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1357 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1358 | { 2, NULL } |
| 1359 | }; |
| 1360 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1361 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1362 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1363 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1364 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1365 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1366 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1367 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1368 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1369 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1370 | { } /* end */ |
| 1371 | }; |
| 1372 | |
| 1373 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1374 | /* |
| 1375 | * ALC880 F1734 model |
| 1376 | * |
| 1377 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1378 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1379 | */ |
| 1380 | |
| 1381 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1382 | 0x03 |
| 1383 | }; |
| 1384 | #define ALC880_F1734_HP_DAC 0x02 |
| 1385 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1386 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1387 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1388 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1389 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1390 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1391 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1392 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1393 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1394 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1395 | { } /* end */ |
| 1396 | }; |
| 1397 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1398 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1399 | .num_items = 2, |
| 1400 | .items = { |
| 1401 | { "Mic", 0x1 }, |
| 1402 | { "CD", 0x4 }, |
| 1403 | }, |
| 1404 | }; |
| 1405 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1406 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1407 | /* |
| 1408 | * ALC880 ASUS model |
| 1409 | * |
| 1410 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1411 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1412 | * Mic = 0x18, Line = 0x1a |
| 1413 | */ |
| 1414 | |
| 1415 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1416 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1417 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1418 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1419 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1420 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1421 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1422 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1423 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1424 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1425 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1426 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1427 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1428 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1429 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1430 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1431 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1432 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1433 | { |
| 1434 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1435 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1436 | .info = alc_ch_mode_info, |
| 1437 | .get = alc_ch_mode_get, |
| 1438 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1439 | }, |
| 1440 | { } /* end */ |
| 1441 | }; |
| 1442 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1443 | /* |
| 1444 | * ALC880 ASUS W1V model |
| 1445 | * |
| 1446 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1447 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1448 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1449 | */ |
| 1450 | |
| 1451 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1452 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1453 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1454 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1455 | { } /* end */ |
| 1456 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1457 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1458 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1459 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1460 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1461 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1462 | { } /* end */ |
| 1463 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1464 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1465 | /* TCL S700 */ |
| 1466 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1467 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1468 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1469 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1470 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1471 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1472 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1473 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1474 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1475 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1476 | { |
| 1477 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1478 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1479 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1480 | */ |
| 1481 | /* .name = "Capture Source", */ |
| 1482 | .name = "Input Source", |
| 1483 | .count = 1, |
| 1484 | .info = alc_mux_enum_info, |
| 1485 | .get = alc_mux_enum_get, |
| 1486 | .put = alc_mux_enum_put, |
| 1487 | }, |
| 1488 | { } /* end */ |
| 1489 | }; |
| 1490 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1491 | /* Uniwill */ |
| 1492 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1493 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1494 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1495 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1496 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1497 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1498 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1499 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1500 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1501 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1502 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1503 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1504 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1505 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1506 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1507 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1508 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1509 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1510 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1511 | { |
| 1512 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1513 | .name = "Channel Mode", |
| 1514 | .info = alc_ch_mode_info, |
| 1515 | .get = alc_ch_mode_get, |
| 1516 | .put = alc_ch_mode_put, |
| 1517 | }, |
| 1518 | { } /* end */ |
| 1519 | }; |
| 1520 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1521 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1522 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1523 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1524 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1525 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1526 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1527 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1528 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1529 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1530 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1531 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1532 | { } /* end */ |
| 1533 | }; |
| 1534 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1535 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1536 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1537 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1538 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1539 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1540 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1541 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1542 | { } /* end */ |
| 1543 | }; |
| 1544 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1545 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1546 | * virtual master controls |
| 1547 | */ |
| 1548 | |
| 1549 | /* |
| 1550 | * slave controls for virtual master |
| 1551 | */ |
| 1552 | static const char *alc_slave_vols[] = { |
| 1553 | "Front Playback Volume", |
| 1554 | "Surround Playback Volume", |
| 1555 | "Center Playback Volume", |
| 1556 | "LFE Playback Volume", |
| 1557 | "Side Playback Volume", |
| 1558 | "Headphone Playback Volume", |
| 1559 | "Speaker Playback Volume", |
| 1560 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1561 | "Line-Out Playback Volume", |
| 1562 | NULL, |
| 1563 | }; |
| 1564 | |
| 1565 | static const char *alc_slave_sws[] = { |
| 1566 | "Front Playback Switch", |
| 1567 | "Surround Playback Switch", |
| 1568 | "Center Playback Switch", |
| 1569 | "LFE Playback Switch", |
| 1570 | "Side Playback Switch", |
| 1571 | "Headphone Playback Switch", |
| 1572 | "Speaker Playback Switch", |
| 1573 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1574 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1575 | NULL, |
| 1576 | }; |
| 1577 | |
| 1578 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1579 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1580 | */ |
| 1581 | static int alc_build_controls(struct hda_codec *codec) |
| 1582 | { |
| 1583 | struct alc_spec *spec = codec->spec; |
| 1584 | int err; |
| 1585 | int i; |
| 1586 | |
| 1587 | for (i = 0; i < spec->num_mixers; i++) { |
| 1588 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1589 | if (err < 0) |
| 1590 | return err; |
| 1591 | } |
| 1592 | |
| 1593 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1594 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1595 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1596 | if (err < 0) |
| 1597 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1598 | err = snd_hda_create_spdif_share_sw(codec, |
| 1599 | &spec->multiout); |
| 1600 | if (err < 0) |
| 1601 | return err; |
| 1602 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1603 | } |
| 1604 | if (spec->dig_in_nid) { |
| 1605 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1606 | if (err < 0) |
| 1607 | return err; |
| 1608 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1609 | |
| 1610 | /* if we have no master control, let's create it */ |
| 1611 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1612 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1613 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1614 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1615 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1616 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1617 | if (err < 0) |
| 1618 | return err; |
| 1619 | } |
| 1620 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1621 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1622 | NULL, alc_slave_sws); |
| 1623 | if (err < 0) |
| 1624 | return err; |
| 1625 | } |
| 1626 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1627 | return 0; |
| 1628 | } |
| 1629 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1630 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1631 | /* |
| 1632 | * initialize the codec volumes, etc |
| 1633 | */ |
| 1634 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1635 | /* |
| 1636 | * generic initialization of ADC, input mixers and output mixers |
| 1637 | */ |
| 1638 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1639 | /* |
| 1640 | * Unmute ADC0-2 and set the default input to mic-in |
| 1641 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1642 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1643 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1644 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1645 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1646 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1647 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1648 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1649 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1650 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1651 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1652 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1653 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1654 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1655 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1656 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1657 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1658 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1659 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1660 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1661 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1662 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1663 | /* |
| 1664 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1665 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1666 | /* set vol=0 to output mixers */ |
| 1667 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1668 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1669 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1670 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1671 | /* set up input amps for analog loopback */ |
| 1672 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1673 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1674 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1675 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1676 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1677 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1678 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1679 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1680 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1681 | |
| 1682 | { } |
| 1683 | }; |
| 1684 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1685 | /* |
| 1686 | * 3-stack pin configuration: |
| 1687 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1688 | */ |
| 1689 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1690 | /* |
| 1691 | * preset connection lists of input pins |
| 1692 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1693 | */ |
| 1694 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1695 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1696 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1697 | |
| 1698 | /* |
| 1699 | * Set pin mode and muting |
| 1700 | */ |
| 1701 | /* set front pin widgets 0x14 for output */ |
| 1702 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1703 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1704 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1705 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1706 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1707 | /* Mic2 (as headphone out) for HP output */ |
| 1708 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1709 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1710 | /* Line In pin widget for input */ |
| 1711 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1712 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1713 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1714 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1715 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1716 | /* CD pin widget for input */ |
| 1717 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1718 | |
| 1719 | { } |
| 1720 | }; |
| 1721 | |
| 1722 | /* |
| 1723 | * 5-stack pin configuration: |
| 1724 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1725 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1726 | */ |
| 1727 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1728 | /* |
| 1729 | * preset connection lists of input pins |
| 1730 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1731 | */ |
| 1732 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1733 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1734 | |
| 1735 | /* |
| 1736 | * Set pin mode and muting |
| 1737 | */ |
| 1738 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1739 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1740 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1741 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1742 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1743 | /* unmute pins for output (no gain on this amp) */ |
| 1744 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1745 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1746 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1747 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1748 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1749 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1750 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1751 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1752 | /* Mic2 (as headphone out) for HP output */ |
| 1753 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1754 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1755 | /* Line In pin widget for input */ |
| 1756 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1757 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1758 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1759 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1760 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1761 | /* CD pin widget for input */ |
| 1762 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1763 | |
| 1764 | { } |
| 1765 | }; |
| 1766 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1767 | /* |
| 1768 | * W810 pin configuration: |
| 1769 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1770 | */ |
| 1771 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1772 | /* hphone/speaker input selector: front DAC */ |
| 1773 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1774 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1775 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1776 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1777 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1778 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1779 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1780 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1781 | |
| 1782 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1783 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1784 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1785 | { } |
| 1786 | }; |
| 1787 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1788 | /* |
| 1789 | * Z71V pin configuration: |
| 1790 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1791 | */ |
| 1792 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1793 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1794 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1795 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1796 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1797 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1798 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1799 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1800 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1801 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1802 | |
| 1803 | { } |
| 1804 | }; |
| 1805 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1806 | /* |
| 1807 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1808 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1809 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1810 | */ |
| 1811 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1812 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1813 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1814 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1815 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1816 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1817 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1818 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1819 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1820 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1821 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1822 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1823 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1824 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1825 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1826 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1827 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1828 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1829 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1830 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1831 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1832 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1833 | { } |
| 1834 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1835 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1836 | /* |
| 1837 | * Uniwill pin configuration: |
| 1838 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1839 | * line = 0x1a |
| 1840 | */ |
| 1841 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1842 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1843 | |
| 1844 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1845 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1846 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1847 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1848 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1849 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1850 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1851 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1852 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1853 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1854 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1855 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1856 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1857 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1858 | |
| 1859 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1860 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1861 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1862 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1863 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1864 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1865 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1866 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1867 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1868 | |
| 1869 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1870 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1871 | |
| 1872 | { } |
| 1873 | }; |
| 1874 | |
| 1875 | /* |
| 1876 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1877 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1878 | */ |
| 1879 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1880 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1881 | |
| 1882 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1883 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1884 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1885 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1886 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1887 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1889 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1890 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1891 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1892 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1893 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1894 | |
| 1895 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1896 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1897 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1898 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1899 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1900 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1901 | |
| 1902 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1903 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1904 | |
| 1905 | { } |
| 1906 | }; |
| 1907 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1908 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1909 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1910 | { } |
| 1911 | }; |
| 1912 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1913 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1914 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1915 | { |
| 1916 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1917 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1918 | |
| 1919 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1920 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1921 | bits = present ? HDA_AMP_MUTE : 0; |
| 1922 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1923 | HDA_AMP_MUTE, bits); |
| 1924 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1925 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1926 | } |
| 1927 | |
| 1928 | /* auto-toggle front mic */ |
| 1929 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1930 | { |
| 1931 | unsigned int present; |
| 1932 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1933 | |
| 1934 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1935 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1936 | bits = present ? HDA_AMP_MUTE : 0; |
| 1937 | 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] | 1938 | } |
| 1939 | |
| 1940 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1941 | { |
| 1942 | alc880_uniwill_hp_automute(codec); |
| 1943 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1944 | } |
| 1945 | |
| 1946 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1947 | unsigned int res) |
| 1948 | { |
| 1949 | /* Looks like the unsol event is incompatible with the standard |
| 1950 | * definition. 4bit tag is placed at 28 bit! |
| 1951 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1952 | switch (res >> 28) { |
| 1953 | case ALC880_HP_EVENT: |
| 1954 | alc880_uniwill_hp_automute(codec); |
| 1955 | break; |
| 1956 | case ALC880_MIC_EVENT: |
| 1957 | alc880_uniwill_mic_automute(codec); |
| 1958 | break; |
| 1959 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1960 | } |
| 1961 | |
| 1962 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1963 | { |
| 1964 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1965 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1966 | |
| 1967 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1968 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1969 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 1970 | 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] | 1971 | } |
| 1972 | |
| 1973 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1974 | { |
| 1975 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1976 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1977 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1978 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1979 | present &= HDA_AMP_VOLMASK; |
| 1980 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1981 | HDA_AMP_VOLMASK, present); |
| 1982 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1983 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1984 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1985 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1986 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1987 | unsigned int res) |
| 1988 | { |
| 1989 | /* Looks like the unsol event is incompatible with the standard |
| 1990 | * definition. 4bit tag is placed at 28 bit! |
| 1991 | */ |
| 1992 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1993 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1994 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1995 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1996 | } |
| 1997 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1998 | /* |
| 1999 | * F1734 pin configuration: |
| 2000 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2001 | */ |
| 2002 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2003 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2004 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2005 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2006 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2007 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2008 | |
| 2009 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2010 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2011 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2012 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2013 | |
| 2014 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2015 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2016 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2017 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2018 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2019 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2020 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2021 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2022 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2023 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2024 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2025 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2026 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2027 | { } |
| 2028 | }; |
| 2029 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2030 | /* |
| 2031 | * ASUS pin configuration: |
| 2032 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2033 | */ |
| 2034 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2035 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2036 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2037 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2038 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2039 | |
| 2040 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2041 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2042 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2043 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2044 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2045 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2046 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2047 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2048 | |
| 2049 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2050 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2051 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2052 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2053 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2054 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2055 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2056 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2057 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2058 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2059 | { } |
| 2060 | }; |
| 2061 | |
| 2062 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2063 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2064 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2065 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2066 | /* Clevo m520g init */ |
| 2067 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2068 | /* headphone output */ |
| 2069 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2070 | /* line-out */ |
| 2071 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2072 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2073 | /* Line-in */ |
| 2074 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2075 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2076 | /* CD */ |
| 2077 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2078 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2079 | /* Mic1 (rear panel) */ |
| 2080 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2081 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2082 | /* Mic2 (front panel) */ |
| 2083 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2084 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2085 | /* headphone */ |
| 2086 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2087 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2088 | /* change to EAPD mode */ |
| 2089 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2090 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2091 | |
| 2092 | { } |
| 2093 | }; |
| 2094 | |
| 2095 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2096 | /* change to EAPD mode */ |
| 2097 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2098 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2099 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2100 | /* Headphone output */ |
| 2101 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2102 | /* Front output*/ |
| 2103 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2104 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2105 | |
| 2106 | /* Line In pin widget for input */ |
| 2107 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2108 | /* CD pin widget for input */ |
| 2109 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2110 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2111 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2112 | |
| 2113 | /* change to EAPD mode */ |
| 2114 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2115 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2116 | |
| 2117 | { } |
| 2118 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2119 | |
| 2120 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2121 | * LG m1 express dual |
| 2122 | * |
| 2123 | * Pin assignment: |
| 2124 | * Rear Line-In/Out (blue): 0x14 |
| 2125 | * Build-in Mic-In: 0x15 |
| 2126 | * Speaker-out: 0x17 |
| 2127 | * HP-Out (green): 0x1b |
| 2128 | * Mic-In/Out (red): 0x19 |
| 2129 | * SPDIF-Out: 0x1e |
| 2130 | */ |
| 2131 | |
| 2132 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2133 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2134 | 0x05, 0x02, 0x03 |
| 2135 | }; |
| 2136 | |
| 2137 | /* seems analog CD is not working */ |
| 2138 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2139 | .num_items = 3, |
| 2140 | .items = { |
| 2141 | { "Mic", 0x1 }, |
| 2142 | { "Line", 0x5 }, |
| 2143 | { "Internal Mic", 0x6 }, |
| 2144 | }, |
| 2145 | }; |
| 2146 | |
| 2147 | /* 2,4,6 channel modes */ |
| 2148 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2149 | /* set line-in and mic-in to input */ |
| 2150 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2151 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2152 | { } |
| 2153 | }; |
| 2154 | |
| 2155 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2156 | /* set line-in to out and mic-in to input */ |
| 2157 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2158 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2159 | { } |
| 2160 | }; |
| 2161 | |
| 2162 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2163 | /* set line-in and mic-in to output */ |
| 2164 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2165 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2166 | { } |
| 2167 | }; |
| 2168 | |
| 2169 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2170 | { 2, alc880_lg_ch2_init }, |
| 2171 | { 4, alc880_lg_ch4_init }, |
| 2172 | { 6, alc880_lg_ch6_init }, |
| 2173 | }; |
| 2174 | |
| 2175 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2176 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2177 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2178 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2179 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2180 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2181 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2182 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2183 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2184 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2185 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2186 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2187 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2188 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2189 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2190 | { |
| 2191 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2192 | .name = "Channel Mode", |
| 2193 | .info = alc_ch_mode_info, |
| 2194 | .get = alc_ch_mode_get, |
| 2195 | .put = alc_ch_mode_put, |
| 2196 | }, |
| 2197 | { } /* end */ |
| 2198 | }; |
| 2199 | |
| 2200 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2201 | /* set capture source to mic-in */ |
| 2202 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2203 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2204 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2205 | /* mute all amp mixer inputs */ |
| 2206 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2207 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2208 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2209 | /* line-in to input */ |
| 2210 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2211 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2212 | /* built-in mic */ |
| 2213 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2214 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2215 | /* speaker-out */ |
| 2216 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2217 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2218 | /* mic-in to input */ |
| 2219 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2220 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2221 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2222 | /* HP-out */ |
| 2223 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2224 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2225 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2226 | /* jack sense */ |
| 2227 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2228 | { } |
| 2229 | }; |
| 2230 | |
| 2231 | /* toggle speaker-output according to the hp-jack state */ |
| 2232 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2233 | { |
| 2234 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2235 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2236 | |
| 2237 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2238 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2239 | bits = present ? HDA_AMP_MUTE : 0; |
| 2240 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2241 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2242 | } |
| 2243 | |
| 2244 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2245 | { |
| 2246 | /* Looks like the unsol event is incompatible with the standard |
| 2247 | * definition. 4bit tag is placed at 28 bit! |
| 2248 | */ |
| 2249 | if ((res >> 28) == 0x01) |
| 2250 | alc880_lg_automute(codec); |
| 2251 | } |
| 2252 | |
| 2253 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2254 | * LG LW20 |
| 2255 | * |
| 2256 | * Pin assignment: |
| 2257 | * Speaker-out: 0x14 |
| 2258 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2259 | * Built-in Mic-In: 0x19 |
| 2260 | * Line-In: 0x1b |
| 2261 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2262 | * SPDIF-Out: 0x1e |
| 2263 | */ |
| 2264 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2265 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2266 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2267 | .items = { |
| 2268 | { "Mic", 0x0 }, |
| 2269 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2270 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2271 | }, |
| 2272 | }; |
| 2273 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2274 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2275 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2276 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2277 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2278 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2279 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2280 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2281 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2282 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2283 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2284 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2285 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2286 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2287 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2288 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2289 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2290 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2291 | { |
| 2292 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2293 | .name = "Channel Mode", |
| 2294 | .info = alc_ch_mode_info, |
| 2295 | .get = alc_ch_mode_get, |
| 2296 | .put = alc_ch_mode_put, |
| 2297 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2298 | { } /* end */ |
| 2299 | }; |
| 2300 | |
| 2301 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2302 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2303 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2304 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2305 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2306 | /* set capture source to mic-in */ |
| 2307 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2308 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2309 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2310 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2311 | /* speaker-out */ |
| 2312 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2313 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2314 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2315 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2316 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2317 | /* mic-in to input */ |
| 2318 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2319 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2320 | /* built-in mic */ |
| 2321 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2322 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2323 | /* jack sense */ |
| 2324 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2325 | { } |
| 2326 | }; |
| 2327 | |
| 2328 | /* toggle speaker-output according to the hp-jack state */ |
| 2329 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2330 | { |
| 2331 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2332 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2333 | |
| 2334 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2335 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2336 | bits = present ? HDA_AMP_MUTE : 0; |
| 2337 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2338 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2339 | } |
| 2340 | |
| 2341 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2342 | { |
| 2343 | /* Looks like the unsol event is incompatible with the standard |
| 2344 | * definition. 4bit tag is placed at 28 bit! |
| 2345 | */ |
| 2346 | if ((res >> 28) == 0x01) |
| 2347 | alc880_lg_lw_automute(codec); |
| 2348 | } |
| 2349 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2350 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2351 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2352 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2353 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2354 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2355 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2356 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2357 | { } /* end */ |
| 2358 | }; |
| 2359 | |
| 2360 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2361 | .num_items = 2, |
| 2362 | .items = { |
| 2363 | { "Mic", 0x0 }, |
| 2364 | { "Internal Mic", 0x1 }, |
| 2365 | }, |
| 2366 | }; |
| 2367 | |
| 2368 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2369 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2370 | |
| 2371 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2372 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2373 | |
| 2374 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2375 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2376 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2377 | /* Mic2 (as headphone out) for HP output */ |
| 2378 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2379 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2380 | /* Internal Speaker */ |
| 2381 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2382 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2383 | |
| 2384 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2385 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2386 | |
| 2387 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2388 | { } |
| 2389 | }; |
| 2390 | |
| 2391 | /* toggle speaker-output according to the hp-jack state */ |
| 2392 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2393 | { |
| 2394 | unsigned int present; |
| 2395 | unsigned char bits; |
| 2396 | |
| 2397 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2398 | AC_VERB_GET_PIN_SENSE, 0) |
| 2399 | & AC_PINSENSE_PRESENCE; |
| 2400 | bits = present ? HDA_AMP_MUTE : 0; |
| 2401 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2402 | HDA_AMP_MUTE, bits); |
| 2403 | if (present) |
| 2404 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2405 | else |
| 2406 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2407 | } |
| 2408 | |
| 2409 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2410 | unsigned int res) |
| 2411 | { |
| 2412 | /* Looks like the unsol event is incompatible with the standard |
| 2413 | * definition. 4bit tag is placed at 28 bit! |
| 2414 | */ |
| 2415 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2416 | alc880_medion_rim_automute(codec); |
| 2417 | } |
| 2418 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2419 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2420 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2421 | { 0x0b, HDA_INPUT, 0 }, |
| 2422 | { 0x0b, HDA_INPUT, 1 }, |
| 2423 | { 0x0b, HDA_INPUT, 2 }, |
| 2424 | { 0x0b, HDA_INPUT, 3 }, |
| 2425 | { 0x0b, HDA_INPUT, 4 }, |
| 2426 | { } /* end */ |
| 2427 | }; |
| 2428 | |
| 2429 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2430 | { 0x0b, HDA_INPUT, 1 }, |
| 2431 | { 0x0b, HDA_INPUT, 6 }, |
| 2432 | { 0x0b, HDA_INPUT, 7 }, |
| 2433 | { } /* end */ |
| 2434 | }; |
| 2435 | #endif |
| 2436 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2437 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2438 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2439 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2440 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2441 | static int alc_init(struct hda_codec *codec) |
| 2442 | { |
| 2443 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2444 | unsigned int i; |
| 2445 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2446 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2447 | if (codec->vendor_id == 0x10ec0888) |
| 2448 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2449 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2450 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2451 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2452 | |
| 2453 | if (spec->init_hook) |
| 2454 | spec->init_hook(codec); |
| 2455 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2456 | return 0; |
| 2457 | } |
| 2458 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2459 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2460 | { |
| 2461 | struct alc_spec *spec = codec->spec; |
| 2462 | |
| 2463 | if (spec->unsol_event) |
| 2464 | spec->unsol_event(codec, res); |
| 2465 | } |
| 2466 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2467 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2468 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2469 | { |
| 2470 | struct alc_spec *spec = codec->spec; |
| 2471 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2472 | } |
| 2473 | #endif |
| 2474 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2475 | /* |
| 2476 | * Analog playback callbacks |
| 2477 | */ |
| 2478 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2479 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2480 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2481 | { |
| 2482 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2483 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2484 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2485 | } |
| 2486 | |
| 2487 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2488 | struct hda_codec *codec, |
| 2489 | unsigned int stream_tag, |
| 2490 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2491 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2492 | { |
| 2493 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2494 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2495 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2496 | } |
| 2497 | |
| 2498 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2499 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2500 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2501 | { |
| 2502 | struct alc_spec *spec = codec->spec; |
| 2503 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2504 | } |
| 2505 | |
| 2506 | /* |
| 2507 | * Digital out |
| 2508 | */ |
| 2509 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2510 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2511 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2512 | { |
| 2513 | struct alc_spec *spec = codec->spec; |
| 2514 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2515 | } |
| 2516 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2517 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2518 | struct hda_codec *codec, |
| 2519 | unsigned int stream_tag, |
| 2520 | unsigned int format, |
| 2521 | struct snd_pcm_substream *substream) |
| 2522 | { |
| 2523 | struct alc_spec *spec = codec->spec; |
| 2524 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2525 | stream_tag, format, substream); |
| 2526 | } |
| 2527 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2528 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2529 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2530 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2531 | { |
| 2532 | struct alc_spec *spec = codec->spec; |
| 2533 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2534 | } |
| 2535 | |
| 2536 | /* |
| 2537 | * Analog capture |
| 2538 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2539 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2540 | struct hda_codec *codec, |
| 2541 | unsigned int stream_tag, |
| 2542 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2543 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2544 | { |
| 2545 | struct alc_spec *spec = codec->spec; |
| 2546 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2547 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2548 | stream_tag, 0, format); |
| 2549 | return 0; |
| 2550 | } |
| 2551 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2552 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2553 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2554 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2555 | { |
| 2556 | struct alc_spec *spec = codec->spec; |
| 2557 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2558 | snd_hda_codec_cleanup_stream(codec, |
| 2559 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2560 | return 0; |
| 2561 | } |
| 2562 | |
| 2563 | |
| 2564 | /* |
| 2565 | */ |
| 2566 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2567 | .substreams = 1, |
| 2568 | .channels_min = 2, |
| 2569 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2570 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2571 | .ops = { |
| 2572 | .open = alc880_playback_pcm_open, |
| 2573 | .prepare = alc880_playback_pcm_prepare, |
| 2574 | .cleanup = alc880_playback_pcm_cleanup |
| 2575 | }, |
| 2576 | }; |
| 2577 | |
| 2578 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2579 | .substreams = 1, |
| 2580 | .channels_min = 2, |
| 2581 | .channels_max = 2, |
| 2582 | /* NID is set in alc_build_pcms */ |
| 2583 | }; |
| 2584 | |
| 2585 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2586 | .substreams = 1, |
| 2587 | .channels_min = 2, |
| 2588 | .channels_max = 2, |
| 2589 | /* NID is set in alc_build_pcms */ |
| 2590 | }; |
| 2591 | |
| 2592 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2593 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2594 | .channels_min = 2, |
| 2595 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2596 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2597 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2598 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2599 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2600 | }, |
| 2601 | }; |
| 2602 | |
| 2603 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2604 | .substreams = 1, |
| 2605 | .channels_min = 2, |
| 2606 | .channels_max = 2, |
| 2607 | /* NID is set in alc_build_pcms */ |
| 2608 | .ops = { |
| 2609 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2610 | .close = alc880_dig_playback_pcm_close, |
| 2611 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2612 | }, |
| 2613 | }; |
| 2614 | |
| 2615 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2616 | .substreams = 1, |
| 2617 | .channels_min = 2, |
| 2618 | .channels_max = 2, |
| 2619 | /* NID is set in alc_build_pcms */ |
| 2620 | }; |
| 2621 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2622 | /* 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] | 2623 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2624 | .substreams = 0, |
| 2625 | .channels_min = 0, |
| 2626 | .channels_max = 0, |
| 2627 | }; |
| 2628 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2629 | static int alc_build_pcms(struct hda_codec *codec) |
| 2630 | { |
| 2631 | struct alc_spec *spec = codec->spec; |
| 2632 | struct hda_pcm *info = spec->pcm_rec; |
| 2633 | int i; |
| 2634 | |
| 2635 | codec->num_pcms = 1; |
| 2636 | codec->pcm_info = info; |
| 2637 | |
| 2638 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2639 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2640 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 2641 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2642 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2643 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2644 | } |
| 2645 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2646 | if (snd_BUG_ON(!spec->adc_nids)) |
| 2647 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2648 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2649 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2650 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2651 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2652 | if (spec->channel_mode) { |
| 2653 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2654 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2655 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2656 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2657 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2658 | } |
| 2659 | } |
| 2660 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2661 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2662 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2663 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2664 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2665 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2666 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2667 | if (spec->multiout.dig_out_nid && |
| 2668 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2669 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2670 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2671 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2672 | if (spec->dig_in_nid && |
| 2673 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2674 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2675 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2676 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 2677 | /* FIXME: do we need this for all Realtek codec models? */ |
| 2678 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2679 | } |
| 2680 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2681 | /* If the use of more than one ADC is requested for the current |
| 2682 | * model, configure a second analog capture-only PCM. |
| 2683 | */ |
| 2684 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2685 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2686 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2687 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2688 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2689 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2690 | if (spec->alt_dac_nid) { |
| 2691 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2692 | *spec->stream_analog_alt_playback; |
| 2693 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2694 | spec->alt_dac_nid; |
| 2695 | } else { |
| 2696 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2697 | alc_pcm_null_stream; |
| 2698 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2699 | } |
| 2700 | if (spec->num_adc_nids > 1) { |
| 2701 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2702 | *spec->stream_analog_alt_capture; |
| 2703 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2704 | spec->adc_nids[1]; |
| 2705 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2706 | spec->num_adc_nids - 1; |
| 2707 | } else { |
| 2708 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2709 | alc_pcm_null_stream; |
| 2710 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2711 | } |
| 2712 | } |
| 2713 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2714 | return 0; |
| 2715 | } |
| 2716 | |
| 2717 | static void alc_free(struct hda_codec *codec) |
| 2718 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2719 | struct alc_spec *spec = codec->spec; |
| 2720 | unsigned int i; |
| 2721 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2722 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2723 | return; |
| 2724 | |
| 2725 | if (spec->kctl_alloc) { |
| 2726 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2727 | kfree(spec->kctl_alloc[i].name); |
| 2728 | kfree(spec->kctl_alloc); |
| 2729 | } |
| 2730 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2731 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2732 | } |
| 2733 | |
| 2734 | /* |
| 2735 | */ |
| 2736 | static struct hda_codec_ops alc_patch_ops = { |
| 2737 | .build_controls = alc_build_controls, |
| 2738 | .build_pcms = alc_build_pcms, |
| 2739 | .init = alc_init, |
| 2740 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2741 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2742 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2743 | .check_power_status = alc_check_power_status, |
| 2744 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2745 | }; |
| 2746 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2747 | |
| 2748 | /* |
| 2749 | * Test configuration for debugging |
| 2750 | * |
| 2751 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2752 | * enum controls. |
| 2753 | */ |
| 2754 | #ifdef CONFIG_SND_DEBUG |
| 2755 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2756 | 0x02, 0x03, 0x04, 0x05 |
| 2757 | }; |
| 2758 | |
| 2759 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2760 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2761 | .items = { |
| 2762 | { "In-1", 0x0 }, |
| 2763 | { "In-2", 0x1 }, |
| 2764 | { "In-3", 0x2 }, |
| 2765 | { "In-4", 0x3 }, |
| 2766 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2767 | { "Front", 0x5 }, |
| 2768 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2769 | }, |
| 2770 | }; |
| 2771 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2772 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2773 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2774 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2775 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2776 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2777 | }; |
| 2778 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2779 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2780 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2781 | { |
| 2782 | static char *texts[] = { |
| 2783 | "N/A", "Line Out", "HP Out", |
| 2784 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2785 | }; |
| 2786 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2787 | uinfo->count = 1; |
| 2788 | uinfo->value.enumerated.items = 8; |
| 2789 | if (uinfo->value.enumerated.item >= 8) |
| 2790 | uinfo->value.enumerated.item = 7; |
| 2791 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2792 | return 0; |
| 2793 | } |
| 2794 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2795 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2796 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2797 | { |
| 2798 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2799 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2800 | unsigned int pin_ctl, item = 0; |
| 2801 | |
| 2802 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2803 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2804 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2805 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2806 | item = 2; |
| 2807 | else |
| 2808 | item = 1; |
| 2809 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2810 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2811 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2812 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2813 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2814 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2815 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2816 | } |
| 2817 | } |
| 2818 | ucontrol->value.enumerated.item[0] = item; |
| 2819 | return 0; |
| 2820 | } |
| 2821 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2822 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2823 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2824 | { |
| 2825 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2826 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2827 | static unsigned int ctls[] = { |
| 2828 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2829 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2830 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2831 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2832 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2833 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2834 | }; |
| 2835 | unsigned int old_ctl, new_ctl; |
| 2836 | |
| 2837 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2838 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2839 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2840 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2841 | int val; |
| 2842 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2843 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2844 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2845 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2846 | HDA_AMP_MUTE : 0; |
| 2847 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2848 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2849 | return 1; |
| 2850 | } |
| 2851 | return 0; |
| 2852 | } |
| 2853 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2854 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2855 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2856 | { |
| 2857 | static char *texts[] = { |
| 2858 | "Front", "Surround", "CLFE", "Side" |
| 2859 | }; |
| 2860 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2861 | uinfo->count = 1; |
| 2862 | uinfo->value.enumerated.items = 4; |
| 2863 | if (uinfo->value.enumerated.item >= 4) |
| 2864 | uinfo->value.enumerated.item = 3; |
| 2865 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2866 | return 0; |
| 2867 | } |
| 2868 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2869 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2870 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2871 | { |
| 2872 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2873 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2874 | unsigned int sel; |
| 2875 | |
| 2876 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2877 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2878 | return 0; |
| 2879 | } |
| 2880 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2881 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2882 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2883 | { |
| 2884 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2885 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2886 | unsigned int sel; |
| 2887 | |
| 2888 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2889 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2890 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2891 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2892 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2893 | return 1; |
| 2894 | } |
| 2895 | return 0; |
| 2896 | } |
| 2897 | |
| 2898 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2899 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2900 | .name = xname, \ |
| 2901 | .info = alc_test_pin_ctl_info, \ |
| 2902 | .get = alc_test_pin_ctl_get, \ |
| 2903 | .put = alc_test_pin_ctl_put, \ |
| 2904 | .private_value = nid \ |
| 2905 | } |
| 2906 | |
| 2907 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2908 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2909 | .name = xname, \ |
| 2910 | .info = alc_test_pin_src_info, \ |
| 2911 | .get = alc_test_pin_src_get, \ |
| 2912 | .put = alc_test_pin_src_put, \ |
| 2913 | .private_value = nid \ |
| 2914 | } |
| 2915 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2916 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2917 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2918 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2919 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2920 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2921 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2922 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2923 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2924 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2925 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2926 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2927 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2928 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2929 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2930 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2931 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2932 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2933 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2934 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2935 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2936 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2937 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2938 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2939 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2940 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2941 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2942 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2943 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2944 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2945 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2946 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2947 | { |
| 2948 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2949 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2950 | .info = alc_ch_mode_info, |
| 2951 | .get = alc_ch_mode_get, |
| 2952 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2953 | }, |
| 2954 | { } /* end */ |
| 2955 | }; |
| 2956 | |
| 2957 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2958 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2959 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2960 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2961 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2962 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2963 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2964 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2965 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2966 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2967 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2968 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2969 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2970 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2971 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2972 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2973 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2974 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2975 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2976 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2977 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2978 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2979 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2980 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2981 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2982 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2983 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2984 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2985 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2986 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2987 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2988 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2989 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2990 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2991 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2992 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2993 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2994 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2995 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2996 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2997 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2998 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2999 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3000 | /* Analog input/passthru */ |
| 3001 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3002 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3003 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3004 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3005 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3006 | { } |
| 3007 | }; |
| 3008 | #endif |
| 3009 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3010 | /* |
| 3011 | */ |
| 3012 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3013 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3014 | [ALC880_3ST] = "3stack", |
| 3015 | [ALC880_TCL_S700] = "tcl", |
| 3016 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3017 | [ALC880_CLEVO] = "clevo", |
| 3018 | [ALC880_5ST] = "5stack", |
| 3019 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3020 | [ALC880_W810] = "w810", |
| 3021 | [ALC880_Z71V] = "z71v", |
| 3022 | [ALC880_6ST] = "6stack", |
| 3023 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3024 | [ALC880_ASUS] = "asus", |
| 3025 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3026 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3027 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3028 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3029 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3030 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3031 | [ALC880_F1734] = "F1734", |
| 3032 | [ALC880_LG] = "lg", |
| 3033 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3034 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3035 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3036 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3037 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3038 | [ALC880_AUTO] = "auto", |
| 3039 | }; |
| 3040 | |
| 3041 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3042 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3043 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3044 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3045 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3046 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3047 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3048 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3049 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3050 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3051 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3052 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3053 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3054 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3055 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3056 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3057 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3058 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3059 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3060 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3061 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3062 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3063 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3064 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3065 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3066 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3067 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3068 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3069 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3070 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3071 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3072 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3073 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3074 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3075 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3076 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3077 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3078 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3079 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3080 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3081 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3082 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3083 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3084 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3085 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3086 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3087 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3088 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3089 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3090 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3091 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3092 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3093 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3094 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3095 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3096 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3097 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3098 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3099 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3100 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3101 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3102 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3103 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3104 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3105 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3106 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3107 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3108 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3109 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3110 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3111 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3112 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3113 | {} |
| 3114 | }; |
| 3115 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3116 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3117 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3118 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3119 | static struct alc_config_preset alc880_presets[] = { |
| 3120 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3121 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3122 | .init_verbs = { alc880_volume_init_verbs, |
| 3123 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3124 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3125 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3126 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3127 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3128 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3129 | .input_mux = &alc880_capture_source, |
| 3130 | }, |
| 3131 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3132 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3133 | .init_verbs = { alc880_volume_init_verbs, |
| 3134 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3135 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3136 | .dac_nids = alc880_dac_nids, |
| 3137 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3138 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3139 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3140 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3141 | .input_mux = &alc880_capture_source, |
| 3142 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3143 | [ALC880_TCL_S700] = { |
| 3144 | .mixers = { alc880_tcl_s700_mixer }, |
| 3145 | .init_verbs = { alc880_volume_init_verbs, |
| 3146 | alc880_pin_tcl_S700_init_verbs, |
| 3147 | alc880_gpio2_init_verbs }, |
| 3148 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3149 | .dac_nids = alc880_dac_nids, |
| 3150 | .hp_nid = 0x03, |
| 3151 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3152 | .channel_mode = alc880_2_jack_modes, |
| 3153 | .input_mux = &alc880_capture_source, |
| 3154 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3155 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3156 | .mixers = { alc880_three_stack_mixer, |
| 3157 | alc880_five_stack_mixer}, |
| 3158 | .init_verbs = { alc880_volume_init_verbs, |
| 3159 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3160 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3161 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3162 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3163 | .channel_mode = alc880_fivestack_modes, |
| 3164 | .input_mux = &alc880_capture_source, |
| 3165 | }, |
| 3166 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3167 | .mixers = { alc880_three_stack_mixer, |
| 3168 | alc880_five_stack_mixer }, |
| 3169 | .init_verbs = { alc880_volume_init_verbs, |
| 3170 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3171 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3172 | .dac_nids = alc880_dac_nids, |
| 3173 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3174 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3175 | .channel_mode = alc880_fivestack_modes, |
| 3176 | .input_mux = &alc880_capture_source, |
| 3177 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3178 | [ALC880_6ST] = { |
| 3179 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3180 | .init_verbs = { alc880_volume_init_verbs, |
| 3181 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3182 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3183 | .dac_nids = alc880_6st_dac_nids, |
| 3184 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3185 | .channel_mode = alc880_sixstack_modes, |
| 3186 | .input_mux = &alc880_6stack_capture_source, |
| 3187 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3188 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3189 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3190 | .init_verbs = { alc880_volume_init_verbs, |
| 3191 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3192 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3193 | .dac_nids = alc880_6st_dac_nids, |
| 3194 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3195 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3196 | .channel_mode = alc880_sixstack_modes, |
| 3197 | .input_mux = &alc880_6stack_capture_source, |
| 3198 | }, |
| 3199 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3200 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3201 | .init_verbs = { alc880_volume_init_verbs, |
| 3202 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3203 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3204 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3205 | .dac_nids = alc880_w810_dac_nids, |
| 3206 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3207 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3208 | .channel_mode = alc880_w810_modes, |
| 3209 | .input_mux = &alc880_capture_source, |
| 3210 | }, |
| 3211 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3212 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3213 | .init_verbs = { alc880_volume_init_verbs, |
| 3214 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3215 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3216 | .dac_nids = alc880_z71v_dac_nids, |
| 3217 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3218 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3219 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3220 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3221 | .input_mux = &alc880_capture_source, |
| 3222 | }, |
| 3223 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3224 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3225 | .init_verbs = { alc880_volume_init_verbs, |
| 3226 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3227 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3228 | .dac_nids = alc880_f1734_dac_nids, |
| 3229 | .hp_nid = 0x02, |
| 3230 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3231 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3232 | .input_mux = &alc880_f1734_capture_source, |
| 3233 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3234 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3235 | }, |
| 3236 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3237 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3238 | .init_verbs = { alc880_volume_init_verbs, |
| 3239 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3240 | alc880_gpio1_init_verbs }, |
| 3241 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3242 | .dac_nids = alc880_asus_dac_nids, |
| 3243 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3244 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3245 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3246 | .input_mux = &alc880_capture_source, |
| 3247 | }, |
| 3248 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3249 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3250 | .init_verbs = { alc880_volume_init_verbs, |
| 3251 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3252 | alc880_gpio1_init_verbs }, |
| 3253 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3254 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3255 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3256 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3257 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3258 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3259 | .input_mux = &alc880_capture_source, |
| 3260 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3261 | [ALC880_ASUS_DIG2] = { |
| 3262 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3263 | .init_verbs = { alc880_volume_init_verbs, |
| 3264 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3265 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3266 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3267 | .dac_nids = alc880_asus_dac_nids, |
| 3268 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3269 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3270 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3271 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3272 | .input_mux = &alc880_capture_source, |
| 3273 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3274 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3275 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3276 | .init_verbs = { alc880_volume_init_verbs, |
| 3277 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3278 | alc880_gpio1_init_verbs }, |
| 3279 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3280 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3281 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3282 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3283 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3284 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3285 | .input_mux = &alc880_capture_source, |
| 3286 | }, |
| 3287 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3288 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3289 | .init_verbs = { alc880_volume_init_verbs, |
| 3290 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3291 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3292 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3293 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3294 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3295 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3296 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3297 | .input_mux = &alc880_capture_source, |
| 3298 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3299 | [ALC880_UNIWILL] = { |
| 3300 | .mixers = { alc880_uniwill_mixer }, |
| 3301 | .init_verbs = { alc880_volume_init_verbs, |
| 3302 | alc880_uniwill_init_verbs }, |
| 3303 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3304 | .dac_nids = alc880_asus_dac_nids, |
| 3305 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3306 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3307 | .channel_mode = alc880_threestack_modes, |
| 3308 | .need_dac_fix = 1, |
| 3309 | .input_mux = &alc880_capture_source, |
| 3310 | .unsol_event = alc880_uniwill_unsol_event, |
| 3311 | .init_hook = alc880_uniwill_automute, |
| 3312 | }, |
| 3313 | [ALC880_UNIWILL_P53] = { |
| 3314 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3315 | .init_verbs = { alc880_volume_init_verbs, |
| 3316 | alc880_uniwill_p53_init_verbs }, |
| 3317 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3318 | .dac_nids = alc880_asus_dac_nids, |
| 3319 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3320 | .channel_mode = alc880_threestack_modes, |
| 3321 | .input_mux = &alc880_capture_source, |
| 3322 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3323 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3324 | }, |
| 3325 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3326 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3327 | alc880_pcbeep_mixer, }, |
| 3328 | .init_verbs = { alc880_volume_init_verbs, |
| 3329 | alc880_uniwill_p53_init_verbs, |
| 3330 | alc880_beep_init_verbs }, |
| 3331 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3332 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3333 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3334 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3335 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3336 | .input_mux = &alc880_capture_source, |
| 3337 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3338 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3339 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3340 | [ALC880_CLEVO] = { |
| 3341 | .mixers = { alc880_three_stack_mixer }, |
| 3342 | .init_verbs = { alc880_volume_init_verbs, |
| 3343 | alc880_pin_clevo_init_verbs }, |
| 3344 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3345 | .dac_nids = alc880_dac_nids, |
| 3346 | .hp_nid = 0x03, |
| 3347 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3348 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3349 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3350 | .input_mux = &alc880_capture_source, |
| 3351 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3352 | [ALC880_LG] = { |
| 3353 | .mixers = { alc880_lg_mixer }, |
| 3354 | .init_verbs = { alc880_volume_init_verbs, |
| 3355 | alc880_lg_init_verbs }, |
| 3356 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3357 | .dac_nids = alc880_lg_dac_nids, |
| 3358 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3359 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3360 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3361 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3362 | .input_mux = &alc880_lg_capture_source, |
| 3363 | .unsol_event = alc880_lg_unsol_event, |
| 3364 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3365 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3366 | .loopbacks = alc880_lg_loopbacks, |
| 3367 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3368 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3369 | [ALC880_LG_LW] = { |
| 3370 | .mixers = { alc880_lg_lw_mixer }, |
| 3371 | .init_verbs = { alc880_volume_init_verbs, |
| 3372 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3373 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3374 | .dac_nids = alc880_dac_nids, |
| 3375 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3376 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3377 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3378 | .input_mux = &alc880_lg_lw_capture_source, |
| 3379 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3380 | .init_hook = alc880_lg_lw_automute, |
| 3381 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3382 | [ALC880_MEDION_RIM] = { |
| 3383 | .mixers = { alc880_medion_rim_mixer }, |
| 3384 | .init_verbs = { alc880_volume_init_verbs, |
| 3385 | alc880_medion_rim_init_verbs, |
| 3386 | alc_gpio2_init_verbs }, |
| 3387 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3388 | .dac_nids = alc880_dac_nids, |
| 3389 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3390 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3391 | .channel_mode = alc880_2_jack_modes, |
| 3392 | .input_mux = &alc880_medion_rim_capture_source, |
| 3393 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3394 | .init_hook = alc880_medion_rim_automute, |
| 3395 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3396 | #ifdef CONFIG_SND_DEBUG |
| 3397 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3398 | .mixers = { alc880_test_mixer }, |
| 3399 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3400 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3401 | .dac_nids = alc880_test_dac_nids, |
| 3402 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3403 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3404 | .channel_mode = alc880_test_modes, |
| 3405 | .input_mux = &alc880_test_capture_source, |
| 3406 | }, |
| 3407 | #endif |
| 3408 | }; |
| 3409 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3410 | /* |
| 3411 | * Automatic parse of I/O pins from the BIOS configuration |
| 3412 | */ |
| 3413 | |
| 3414 | #define NUM_CONTROL_ALLOC 32 |
| 3415 | #define NUM_VERB_ALLOC 32 |
| 3416 | |
| 3417 | enum { |
| 3418 | ALC_CTL_WIDGET_VOL, |
| 3419 | ALC_CTL_WIDGET_MUTE, |
| 3420 | ALC_CTL_BIND_MUTE, |
| 3421 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3422 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3423 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3424 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3425 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3426 | }; |
| 3427 | |
| 3428 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3429 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3430 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3431 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3432 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3433 | |
| 3434 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3435 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3436 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3437 | /* array + terminator */ |
| 3438 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3439 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3440 | return -ENOMEM; |
| 3441 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3442 | memcpy(knew, spec->kctl_alloc, |
| 3443 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3444 | kfree(spec->kctl_alloc); |
| 3445 | } |
| 3446 | spec->kctl_alloc = knew; |
| 3447 | spec->num_kctl_alloc = num; |
| 3448 | } |
| 3449 | |
| 3450 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3451 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3452 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3453 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3454 | return -ENOMEM; |
| 3455 | knew->private_value = val; |
| 3456 | spec->num_kctl_used++; |
| 3457 | return 0; |
| 3458 | } |
| 3459 | |
| 3460 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3461 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3462 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3463 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3464 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3465 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3466 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3467 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3468 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3469 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3470 | #define ALC880_PIN_CD_NID 0x1c |
| 3471 | |
| 3472 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3473 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3474 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3475 | { |
| 3476 | hda_nid_t nid; |
| 3477 | int assigned[4]; |
| 3478 | int i, j; |
| 3479 | |
| 3480 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3481 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3482 | |
| 3483 | /* check the pins hardwired to audio widget */ |
| 3484 | for (i = 0; i < cfg->line_outs; i++) { |
| 3485 | nid = cfg->line_out_pins[i]; |
| 3486 | if (alc880_is_fixed_pin(nid)) { |
| 3487 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3488 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3489 | assigned[idx] = 1; |
| 3490 | } |
| 3491 | } |
| 3492 | /* left pins can be connect to any audio widget */ |
| 3493 | for (i = 0; i < cfg->line_outs; i++) { |
| 3494 | nid = cfg->line_out_pins[i]; |
| 3495 | if (alc880_is_fixed_pin(nid)) |
| 3496 | continue; |
| 3497 | /* search for an empty channel */ |
| 3498 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3499 | if (!assigned[j]) { |
| 3500 | spec->multiout.dac_nids[i] = |
| 3501 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3502 | assigned[j] = 1; |
| 3503 | break; |
| 3504 | } |
| 3505 | } |
| 3506 | } |
| 3507 | spec->multiout.num_dacs = cfg->line_outs; |
| 3508 | return 0; |
| 3509 | } |
| 3510 | |
| 3511 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3512 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3513 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3514 | { |
| 3515 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3516 | static const char *chname[4] = { |
| 3517 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3518 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3519 | hda_nid_t nid; |
| 3520 | int i, err; |
| 3521 | |
| 3522 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3523 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3524 | continue; |
| 3525 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3526 | if (i == 2) { |
| 3527 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3528 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3529 | "Center Playback Volume", |
| 3530 | HDA_COMPOSE_AMP_VAL(nid, 1, 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_WIDGET_VOL, |
| 3535 | "LFE Playback Volume", |
| 3536 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3537 | HDA_OUTPUT)); |
| 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 | "Center Playback Switch", |
| 3542 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3543 | HDA_INPUT)); |
| 3544 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3545 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3546 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3547 | "LFE Playback Switch", |
| 3548 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3549 | HDA_INPUT)); |
| 3550 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3551 | return err; |
| 3552 | } else { |
| 3553 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3554 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3555 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3556 | HDA_OUTPUT)); |
| 3557 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3558 | return err; |
| 3559 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3560 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3561 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3562 | HDA_INPUT)); |
| 3563 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3564 | return err; |
| 3565 | } |
| 3566 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3567 | return 0; |
| 3568 | } |
| 3569 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3570 | /* add playback controls for speaker and HP outputs */ |
| 3571 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3572 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3573 | { |
| 3574 | hda_nid_t nid; |
| 3575 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3576 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3577 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3578 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3579 | return 0; |
| 3580 | |
| 3581 | if (alc880_is_fixed_pin(pin)) { |
| 3582 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3583 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3584 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3585 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3586 | else |
| 3587 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3588 | /* control HP volume/switch on the output mixer amp */ |
| 3589 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3590 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3591 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3592 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3593 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3594 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3595 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3596 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3597 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3598 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3599 | return err; |
| 3600 | } else if (alc880_is_multi_pin(pin)) { |
| 3601 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3602 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3603 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3604 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3605 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3606 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3607 | return err; |
| 3608 | } |
| 3609 | return 0; |
| 3610 | } |
| 3611 | |
| 3612 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3613 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3614 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3615 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3616 | { |
| 3617 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3618 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3619 | |
| 3620 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3621 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3622 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3623 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3624 | return err; |
| 3625 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3626 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3627 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3628 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3629 | return err; |
| 3630 | return 0; |
| 3631 | } |
| 3632 | |
| 3633 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3634 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3635 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3636 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3637 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3638 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3639 | |
| 3640 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3641 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3642 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3643 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3644 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3645 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3646 | if (err < 0) |
| 3647 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3648 | imux->items[imux->num_items].label = |
| 3649 | auto_pin_cfg_labels[i]; |
| 3650 | imux->items[imux->num_items].index = |
| 3651 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3652 | imux->num_items++; |
| 3653 | } |
| 3654 | } |
| 3655 | return 0; |
| 3656 | } |
| 3657 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3658 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3659 | unsigned int pin_type) |
| 3660 | { |
| 3661 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3662 | pin_type); |
| 3663 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3664 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3665 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3666 | } |
| 3667 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3668 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3669 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3670 | int dac_idx) |
| 3671 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3672 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3673 | /* need the manual connection? */ |
| 3674 | if (alc880_is_multi_pin(nid)) { |
| 3675 | struct alc_spec *spec = codec->spec; |
| 3676 | int idx = alc880_multi_pin_idx(nid); |
| 3677 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3678 | AC_VERB_SET_CONNECT_SEL, |
| 3679 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3680 | } |
| 3681 | } |
| 3682 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3683 | static int get_pin_type(int line_out_type) |
| 3684 | { |
| 3685 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3686 | return PIN_HP; |
| 3687 | else |
| 3688 | return PIN_OUT; |
| 3689 | } |
| 3690 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3691 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3692 | { |
| 3693 | struct alc_spec *spec = codec->spec; |
| 3694 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3695 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3696 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3697 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3698 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3699 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3700 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3701 | } |
| 3702 | } |
| 3703 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3704 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3705 | { |
| 3706 | struct alc_spec *spec = codec->spec; |
| 3707 | hda_nid_t pin; |
| 3708 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3709 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3710 | if (pin) /* connect to front */ |
| 3711 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3712 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3713 | if (pin) /* connect to front */ |
| 3714 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3715 | } |
| 3716 | |
| 3717 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3718 | { |
| 3719 | struct alc_spec *spec = codec->spec; |
| 3720 | int i; |
| 3721 | |
| 3722 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3723 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3724 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3725 | snd_hda_codec_write(codec, nid, 0, |
| 3726 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3727 | i <= AUTO_PIN_FRONT_MIC ? |
| 3728 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3729 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3730 | snd_hda_codec_write(codec, nid, 0, |
| 3731 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3732 | AMP_OUT_MUTE); |
| 3733 | } |
| 3734 | } |
| 3735 | } |
| 3736 | |
| 3737 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3738 | /* return 1 if successful, 0 if the proper config is not found, |
| 3739 | * or a negative error code |
| 3740 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3741 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3742 | { |
| 3743 | struct alc_spec *spec = codec->spec; |
| 3744 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3745 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3746 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3747 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3748 | alc880_ignore); |
| 3749 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3750 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3751 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3752 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3753 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3754 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3755 | if (err < 0) |
| 3756 | return err; |
| 3757 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3758 | if (err < 0) |
| 3759 | return err; |
| 3760 | err = alc880_auto_create_extra_out(spec, |
| 3761 | spec->autocfg.speaker_pins[0], |
| 3762 | "Speaker"); |
| 3763 | if (err < 0) |
| 3764 | return err; |
| 3765 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3766 | "Headphone"); |
| 3767 | if (err < 0) |
| 3768 | return err; |
| 3769 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3770 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3771 | return err; |
| 3772 | |
| 3773 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3774 | |
| 3775 | if (spec->autocfg.dig_out_pin) |
| 3776 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3777 | if (spec->autocfg.dig_in_pin) |
| 3778 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3779 | |
| 3780 | if (spec->kctl_alloc) |
| 3781 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3782 | |
| 3783 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3784 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3785 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3786 | spec->input_mux = &spec->private_imux; |
| 3787 | |
| 3788 | return 1; |
| 3789 | } |
| 3790 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3791 | /* additional initialization for auto-configuration model */ |
| 3792 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3793 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3794 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3795 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3796 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3797 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3798 | if (spec->unsol_event) |
| 3799 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3800 | } |
| 3801 | |
| 3802 | /* |
| 3803 | * OK, here we have finally the patch for ALC880 |
| 3804 | */ |
| 3805 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3806 | static int patch_alc880(struct hda_codec *codec) |
| 3807 | { |
| 3808 | struct alc_spec *spec; |
| 3809 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3810 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3811 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3812 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3813 | if (spec == NULL) |
| 3814 | return -ENOMEM; |
| 3815 | |
| 3816 | codec->spec = spec; |
| 3817 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3818 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3819 | alc880_models, |
| 3820 | alc880_cfg_tbl); |
| 3821 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3822 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3823 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3824 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3825 | } |
| 3826 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3827 | if (board_config == ALC880_AUTO) { |
| 3828 | /* automatic parse from the BIOS config */ |
| 3829 | err = alc880_parse_auto_config(codec); |
| 3830 | if (err < 0) { |
| 3831 | alc_free(codec); |
| 3832 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3833 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3834 | printk(KERN_INFO |
| 3835 | "hda_codec: Cannot set up configuration " |
| 3836 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3837 | board_config = ALC880_3ST; |
| 3838 | } |
| 3839 | } |
| 3840 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3841 | if (board_config != ALC880_AUTO) |
| 3842 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3843 | |
| 3844 | spec->stream_name_analog = "ALC880 Analog"; |
| 3845 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3846 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3847 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3848 | |
| 3849 | spec->stream_name_digital = "ALC880 Digital"; |
| 3850 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3851 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3852 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3853 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3854 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3855 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3856 | /* get type */ |
| 3857 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3858 | if (wcap != AC_WID_AUD_IN) { |
| 3859 | spec->adc_nids = alc880_adc_nids_alt; |
| 3860 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3861 | spec->mixers[spec->num_mixers] = |
| 3862 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3863 | spec->num_mixers++; |
| 3864 | } else { |
| 3865 | spec->adc_nids = alc880_adc_nids; |
| 3866 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3867 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3868 | spec->num_mixers++; |
| 3869 | } |
| 3870 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3871 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3872 | spec->vmaster_nid = 0x0c; |
| 3873 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3874 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3875 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3876 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3877 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3878 | if (!spec->loopback.amplist) |
| 3879 | spec->loopback.amplist = alc880_loopbacks; |
| 3880 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3881 | |
| 3882 | return 0; |
| 3883 | } |
| 3884 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3885 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3886 | /* |
| 3887 | * ALC260 support |
| 3888 | */ |
| 3889 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3890 | static hda_nid_t alc260_dac_nids[1] = { |
| 3891 | /* front */ |
| 3892 | 0x02, |
| 3893 | }; |
| 3894 | |
| 3895 | static hda_nid_t alc260_adc_nids[1] = { |
| 3896 | /* ADC0 */ |
| 3897 | 0x04, |
| 3898 | }; |
| 3899 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3900 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3901 | /* ADC1 */ |
| 3902 | 0x05, |
| 3903 | }; |
| 3904 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3905 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3906 | /* ADC1, 0 */ |
| 3907 | 0x05, 0x04 |
| 3908 | }; |
| 3909 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3910 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3911 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3912 | */ |
| 3913 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3914 | /* ADC0, ADC1 */ |
| 3915 | 0x04, 0x05 |
| 3916 | }; |
| 3917 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3918 | #define ALC260_DIGOUT_NID 0x03 |
| 3919 | #define ALC260_DIGIN_NID 0x06 |
| 3920 | |
| 3921 | static struct hda_input_mux alc260_capture_source = { |
| 3922 | .num_items = 4, |
| 3923 | .items = { |
| 3924 | { "Mic", 0x0 }, |
| 3925 | { "Front Mic", 0x1 }, |
| 3926 | { "Line", 0x2 }, |
| 3927 | { "CD", 0x4 }, |
| 3928 | }, |
| 3929 | }; |
| 3930 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3931 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3932 | * headphone jack and the internal CD lines since these are the only pins at |
| 3933 | * which audio can appear. For flexibility, also allow the option of |
| 3934 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3935 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3936 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3937 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3938 | { |
| 3939 | .num_items = 3, |
| 3940 | .items = { |
| 3941 | { "Mic/Line", 0x0 }, |
| 3942 | { "CD", 0x4 }, |
| 3943 | { "Headphone", 0x2 }, |
| 3944 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3945 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3946 | { |
| 3947 | .num_items = 4, |
| 3948 | .items = { |
| 3949 | { "Mic/Line", 0x0 }, |
| 3950 | { "CD", 0x4 }, |
| 3951 | { "Headphone", 0x2 }, |
| 3952 | { "Mixer", 0x5 }, |
| 3953 | }, |
| 3954 | }, |
| 3955 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3956 | }; |
| 3957 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3958 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3959 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3960 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3961 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3962 | { |
| 3963 | .num_items = 4, |
| 3964 | .items = { |
| 3965 | { "Mic", 0x0 }, |
| 3966 | { "Line", 0x2 }, |
| 3967 | { "CD", 0x4 }, |
| 3968 | { "Headphone", 0x5 }, |
| 3969 | }, |
| 3970 | }, |
| 3971 | { |
| 3972 | .num_items = 5, |
| 3973 | .items = { |
| 3974 | { "Mic", 0x0 }, |
| 3975 | { "Line", 0x2 }, |
| 3976 | { "CD", 0x4 }, |
| 3977 | { "Headphone", 0x6 }, |
| 3978 | { "Mixer", 0x5 }, |
| 3979 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3980 | }, |
| 3981 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3982 | /* |
| 3983 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3984 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3985 | * element which allows changing the channel mode, so the verb list is |
| 3986 | * never used. |
| 3987 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3988 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3989 | { 2, NULL }, |
| 3990 | }; |
| 3991 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3992 | |
| 3993 | /* Mixer combinations |
| 3994 | * |
| 3995 | * basic: base_output + input + pc_beep + capture |
| 3996 | * HP: base_output + input + capture_alt |
| 3997 | * HP_3013: hp_3013 + input + capture |
| 3998 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3999 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4000 | */ |
| 4001 | |
| 4002 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4003 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4004 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4005 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4006 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4007 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4008 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4009 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4010 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4011 | |
| 4012 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4013 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4014 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4015 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4016 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4017 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4018 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4019 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4020 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4021 | { } /* end */ |
| 4022 | }; |
| 4023 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4024 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 4025 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4026 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4027 | { } /* end */ |
| 4028 | }; |
| 4029 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4030 | /* update HP, line and mono out pins according to the master switch */ |
| 4031 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4032 | hda_nid_t hp, hda_nid_t line, |
| 4033 | hda_nid_t mono) |
| 4034 | { |
| 4035 | struct alc_spec *spec = codec->spec; |
| 4036 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4037 | /* change HP and line-out pins */ |
| 4038 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4039 | val); |
| 4040 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4041 | val); |
| 4042 | /* mono (speaker) depending on the HP jack sense */ |
| 4043 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 4044 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4045 | val); |
| 4046 | } |
| 4047 | |
| 4048 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4049 | struct snd_ctl_elem_value *ucontrol) |
| 4050 | { |
| 4051 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4052 | struct alc_spec *spec = codec->spec; |
| 4053 | *ucontrol->value.integer.value = spec->master_sw; |
| 4054 | return 0; |
| 4055 | } |
| 4056 | |
| 4057 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4058 | struct snd_ctl_elem_value *ucontrol) |
| 4059 | { |
| 4060 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4061 | struct alc_spec *spec = codec->spec; |
| 4062 | int val = !!*ucontrol->value.integer.value; |
| 4063 | hda_nid_t hp, line, mono; |
| 4064 | |
| 4065 | if (val == spec->master_sw) |
| 4066 | return 0; |
| 4067 | spec->master_sw = val; |
| 4068 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4069 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4070 | mono = kcontrol->private_value & 0xff; |
| 4071 | alc260_hp_master_update(codec, hp, line, mono); |
| 4072 | return 1; |
| 4073 | } |
| 4074 | |
| 4075 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4076 | { |
| 4077 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4078 | .name = "Master Playback Switch", |
| 4079 | .info = snd_ctl_boolean_mono_info, |
| 4080 | .get = alc260_hp_master_sw_get, |
| 4081 | .put = alc260_hp_master_sw_put, |
| 4082 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4083 | }, |
| 4084 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4085 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4086 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4087 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4088 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4089 | HDA_OUTPUT), |
| 4090 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4091 | { } /* end */ |
| 4092 | }; |
| 4093 | |
| 4094 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4095 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4096 | {}, |
| 4097 | }; |
| 4098 | |
| 4099 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4100 | { |
| 4101 | struct alc_spec *spec = codec->spec; |
| 4102 | unsigned int present; |
| 4103 | |
| 4104 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4105 | AC_VERB_GET_PIN_SENSE, 0); |
| 4106 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4107 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4108 | } |
| 4109 | |
| 4110 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4111 | { |
| 4112 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4113 | alc260_hp_automute(codec); |
| 4114 | } |
| 4115 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4116 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4117 | { |
| 4118 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4119 | .name = "Master Playback Switch", |
| 4120 | .info = snd_ctl_boolean_mono_info, |
| 4121 | .get = alc260_hp_master_sw_get, |
| 4122 | .put = alc260_hp_master_sw_put, |
| 4123 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 4124 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4125 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4126 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4127 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4128 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4129 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4130 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4131 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4132 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4133 | { } /* end */ |
| 4134 | }; |
| 4135 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4136 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4137 | .ops = &snd_hda_bind_vol, |
| 4138 | .values = { |
| 4139 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4140 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4141 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4142 | 0 |
| 4143 | }, |
| 4144 | }; |
| 4145 | |
| 4146 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4147 | .ops = &snd_hda_bind_sw, |
| 4148 | .values = { |
| 4149 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4150 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4151 | 0 |
| 4152 | }, |
| 4153 | }; |
| 4154 | |
| 4155 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4156 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4157 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4158 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4159 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4160 | { } /* end */ |
| 4161 | }; |
| 4162 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4163 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4164 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4165 | {}, |
| 4166 | }; |
| 4167 | |
| 4168 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4169 | { |
| 4170 | struct alc_spec *spec = codec->spec; |
| 4171 | unsigned int present; |
| 4172 | |
| 4173 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4174 | AC_VERB_GET_PIN_SENSE, 0); |
| 4175 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4176 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 4177 | } |
| 4178 | |
| 4179 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4180 | unsigned int res) |
| 4181 | { |
| 4182 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4183 | alc260_hp_3013_automute(codec); |
| 4184 | } |
| 4185 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4186 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4187 | { |
| 4188 | unsigned int present, bits; |
| 4189 | |
| 4190 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4191 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4192 | |
| 4193 | bits = present ? 0 : PIN_OUT; |
| 4194 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4195 | bits); |
| 4196 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4197 | bits); |
| 4198 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4199 | bits); |
| 4200 | } |
| 4201 | |
| 4202 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4203 | unsigned int res) |
| 4204 | { |
| 4205 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4206 | alc260_hp_3012_automute(codec); |
| 4207 | } |
| 4208 | |
| 4209 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4210 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4211 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4212 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4213 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4214 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4215 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4216 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4217 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4218 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4219 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4220 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4221 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4222 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4223 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4224 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4225 | { } /* end */ |
| 4226 | }; |
| 4227 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4228 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4229 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4230 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4231 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4232 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4233 | * revisions available in early 2006. Therefore for now allow the |
| 4234 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4235 | * that the lack of mic bias for this NID is intentional we could change the |
| 4236 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4237 | * |
| 4238 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4239 | * don't appear to make the mic bias available from the "line" jack, even |
| 4240 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4241 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4242 | * and the output jack. If this turns out to be the case for all such |
| 4243 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4244 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4245 | * |
| 4246 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4247 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4248 | * controls for such models. On models without a "mono speaker" the control |
| 4249 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4250 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4251 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4252 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4253 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4254 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4255 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4256 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4257 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4258 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4259 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4260 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4261 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4262 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4263 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4264 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4265 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4266 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4267 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4268 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4269 | { } /* end */ |
| 4270 | }; |
| 4271 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4272 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4273 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4274 | */ |
| 4275 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4276 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4277 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4278 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4279 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4280 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4281 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4282 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4283 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4284 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4285 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4286 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4287 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4288 | { } /* end */ |
| 4289 | }; |
| 4290 | |
| 4291 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4292 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4293 | */ |
| 4294 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4295 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4296 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4297 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4298 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4299 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4300 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4301 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4302 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4303 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4304 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4305 | { } /* end */ |
| 4306 | }; |
| 4307 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4308 | /* capture mixer elements */ |
| 4309 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4310 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4311 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4312 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4313 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4314 | { |
| 4315 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4316 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4317 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4318 | */ |
| 4319 | /* .name = "Capture Source", */ |
| 4320 | .name = "Input Source", |
| 4321 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4322 | .info = alc_mux_enum_info, |
| 4323 | .get = alc_mux_enum_get, |
| 4324 | .put = alc_mux_enum_put, |
| 4325 | }, |
| 4326 | { } /* end */ |
| 4327 | }; |
| 4328 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4329 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4330 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4331 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4332 | { |
| 4333 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4334 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4335 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4336 | */ |
| 4337 | /* .name = "Capture Source", */ |
| 4338 | .name = "Input Source", |
| 4339 | .count = 1, |
| 4340 | .info = alc_mux_enum_info, |
| 4341 | .get = alc_mux_enum_get, |
| 4342 | .put = alc_mux_enum_put, |
| 4343 | }, |
| 4344 | { } /* end */ |
| 4345 | }; |
| 4346 | |
| 4347 | /* |
| 4348 | * initialization verbs |
| 4349 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4350 | static struct hda_verb alc260_init_verbs[] = { |
| 4351 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4352 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4353 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4354 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4355 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4356 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4357 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4358 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4359 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4360 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4361 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4362 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4363 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4364 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4365 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4366 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4367 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4368 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4369 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4370 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4371 | /* set connection select to line in (default select for this ADC) */ |
| 4372 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4373 | /* mute capture amp left and right */ |
| 4374 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4375 | /* set connection select to line in (default select for this ADC) */ |
| 4376 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4377 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4378 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4379 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4380 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4381 | /* set vol=0 HP mixer amp left and right */ |
| 4382 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4383 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4384 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4385 | /* set vol=0 Mono mixer amp left and right */ |
| 4386 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4387 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4388 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4389 | /* unmute LINE-2 out pin */ |
| 4390 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4391 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4392 | * Line In 2 = 0x03 |
| 4393 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4394 | /* mute analog inputs */ |
| 4395 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4396 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4399 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4400 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4401 | /* mute Front out path */ |
| 4402 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4403 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4404 | /* mute Headphone out path */ |
| 4405 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4406 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4407 | /* mute Mono out path */ |
| 4408 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4409 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4410 | { } |
| 4411 | }; |
| 4412 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4413 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4414 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4415 | /* Headphone and output */ |
| 4416 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4417 | /* mono output */ |
| 4418 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4419 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4420 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4421 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4422 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4423 | /* Line In pin widget for input */ |
| 4424 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4425 | /* Line-2 pin widget for output */ |
| 4426 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4427 | /* CD pin widget for input */ |
| 4428 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4429 | /* unmute amp left and right */ |
| 4430 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4431 | /* set connection select to line in (default select for this ADC) */ |
| 4432 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4433 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4434 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4435 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4436 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4437 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4438 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4439 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4440 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4441 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4442 | * Line In 2 = 0x03 |
| 4443 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4444 | /* mute analog inputs */ |
| 4445 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4446 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4447 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4448 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4449 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4450 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4451 | /* Unmute Front out path */ |
| 4452 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4453 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4454 | /* Unmute Headphone out path */ |
| 4455 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4456 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4457 | /* Unmute Mono out path */ |
| 4458 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4459 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4460 | { } |
| 4461 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4462 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4463 | |
| 4464 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4465 | /* Line out and output */ |
| 4466 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4467 | /* mono output */ |
| 4468 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4469 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4470 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4471 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4472 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4473 | /* Line In pin widget for input */ |
| 4474 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4475 | /* Headphone pin widget for output */ |
| 4476 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4477 | /* CD pin widget for input */ |
| 4478 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4479 | /* unmute amp left and right */ |
| 4480 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4481 | /* set connection select to line in (default select for this ADC) */ |
| 4482 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4483 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4484 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4485 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4486 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4487 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4488 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4489 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4490 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4491 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4492 | * Line In 2 = 0x03 |
| 4493 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4494 | /* mute analog inputs */ |
| 4495 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4496 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4497 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4498 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4499 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4500 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4501 | /* Unmute Front out path */ |
| 4502 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4503 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4504 | /* Unmute Headphone out path */ |
| 4505 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4506 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4507 | /* Unmute Mono out path */ |
| 4508 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4509 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4510 | { } |
| 4511 | }; |
| 4512 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4513 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4514 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4515 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4516 | */ |
| 4517 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4518 | /* Disable all GPIOs */ |
| 4519 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4520 | /* Internal speaker is connected to headphone pin */ |
| 4521 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4522 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4523 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4524 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4525 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4526 | /* Ensure all other unused pins are disabled and muted. */ |
| 4527 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4528 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4529 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4530 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4531 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4532 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4533 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4534 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4535 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4536 | /* Disable digital (SPDIF) pins */ |
| 4537 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4538 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4539 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4540 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4541 | * when acting as an output. |
| 4542 | */ |
| 4543 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4544 | |
| 4545 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4546 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4547 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4548 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4549 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4550 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4551 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4552 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4553 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4554 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4555 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4556 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4557 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4558 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4559 | * If the pin mode is changed by the user the pin mode control will |
| 4560 | * take care of enabling the pin's input/output buffers as needed. |
| 4561 | * Therefore there's no need to enable the input buffer at this |
| 4562 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4563 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4564 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4565 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4566 | * mixer ctrl) |
| 4567 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4568 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4569 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4570 | /* Mute capture amp left and right */ |
| 4571 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4572 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4573 | * in (on mic1 pin) |
| 4574 | */ |
| 4575 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4576 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4577 | /* Do the same for the second ADC: mute capture input amp and |
| 4578 | * set ADC connection to line in (on mic1 pin) |
| 4579 | */ |
| 4580 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4581 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4582 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4583 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4584 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4585 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4586 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4587 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4588 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4589 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4590 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4591 | {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] | 4592 | |
| 4593 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4594 | }; |
| 4595 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4596 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4597 | * similar laptops (adapted from Fujitsu init verbs). |
| 4598 | */ |
| 4599 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4600 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4601 | * the headphone jack. Turn this on and rely on the standard mute |
| 4602 | * methods whenever the user wants to turn these outputs off. |
| 4603 | */ |
| 4604 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4605 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4606 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4607 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4608 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4609 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4610 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4611 | /* Line In jack is connected to Line1 pin */ |
| 4612 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4613 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4614 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4615 | /* Ensure all other unused pins are disabled and muted. */ |
| 4616 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4617 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4618 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4619 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4620 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4621 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4622 | /* Disable digital (SPDIF) pins */ |
| 4623 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4624 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4625 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4626 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4627 | * bus when acting as outputs. |
| 4628 | */ |
| 4629 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4630 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4631 | |
| 4632 | /* Start with output sum widgets muted and their output gains at min */ |
| 4633 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4634 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4635 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4636 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4637 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4638 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4639 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4640 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4641 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4642 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4643 | /* Unmute Line-out pin widget amp left and right |
| 4644 | * (no equiv mixer ctrl) |
| 4645 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4646 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4647 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4648 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4649 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4650 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4651 | * will take care of enabling the pin's input/output buffers as needed. |
| 4652 | * Therefore there's no need to enable the input buffer at this |
| 4653 | * stage. |
| 4654 | */ |
| 4655 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4656 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4657 | |
| 4658 | /* Mute capture amp left and right */ |
| 4659 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4660 | /* Set ADC connection select to match default mixer setting - mic |
| 4661 | * (on mic1 pin) |
| 4662 | */ |
| 4663 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4664 | |
| 4665 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4666 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4667 | */ |
| 4668 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4669 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4670 | |
| 4671 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4672 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4673 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4674 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4675 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4676 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4677 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4678 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4679 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4680 | |
| 4681 | { } |
| 4682 | }; |
| 4683 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4684 | static struct hda_verb alc260_will_verbs[] = { |
| 4685 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4686 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4687 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4688 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4689 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4690 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4691 | {} |
| 4692 | }; |
| 4693 | |
| 4694 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4695 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4696 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4697 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4698 | |
| 4699 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4700 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4701 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4702 | |
| 4703 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4704 | {} |
| 4705 | }; |
| 4706 | |
| 4707 | /* toggle speaker-output according to the hp-jack state */ |
| 4708 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4709 | { |
| 4710 | unsigned int present; |
| 4711 | |
| 4712 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4713 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4714 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4715 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4716 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4717 | AC_VERB_SET_GPIO_DATA, 1); |
| 4718 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4719 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4720 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4721 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4722 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4723 | AC_VERB_SET_GPIO_DATA, 0); |
| 4724 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4725 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4726 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4727 | } |
| 4728 | } |
| 4729 | |
| 4730 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4731 | unsigned int res) |
| 4732 | { |
| 4733 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4734 | alc260_replacer_672v_automute(codec); |
| 4735 | } |
| 4736 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4737 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 4738 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4739 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4740 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4741 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4742 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4743 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4744 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4745 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4746 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4747 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4748 | {} |
| 4749 | }; |
| 4750 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4751 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4752 | * configuration. |
| 4753 | */ |
| 4754 | #ifdef CONFIG_SND_DEBUG |
| 4755 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4756 | 0x02, |
| 4757 | }; |
| 4758 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4759 | 0x04, 0x05, |
| 4760 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4761 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4762 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4763 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4764 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4765 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4766 | { |
| 4767 | .num_items = 7, |
| 4768 | .items = { |
| 4769 | { "MIC1 pin", 0x0 }, |
| 4770 | { "MIC2 pin", 0x1 }, |
| 4771 | { "LINE1 pin", 0x2 }, |
| 4772 | { "LINE2 pin", 0x3 }, |
| 4773 | { "CD pin", 0x4 }, |
| 4774 | { "LINE-OUT pin", 0x5 }, |
| 4775 | { "HP-OUT pin", 0x6 }, |
| 4776 | }, |
| 4777 | }, |
| 4778 | { |
| 4779 | .num_items = 8, |
| 4780 | .items = { |
| 4781 | { "MIC1 pin", 0x0 }, |
| 4782 | { "MIC2 pin", 0x1 }, |
| 4783 | { "LINE1 pin", 0x2 }, |
| 4784 | { "LINE2 pin", 0x3 }, |
| 4785 | { "CD pin", 0x4 }, |
| 4786 | { "Mixer", 0x5 }, |
| 4787 | { "LINE-OUT pin", 0x6 }, |
| 4788 | { "HP-OUT pin", 0x7 }, |
| 4789 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4790 | }, |
| 4791 | }; |
| 4792 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4793 | /* Output driver widgets */ |
| 4794 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4795 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4796 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4797 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4798 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4799 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4800 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4801 | /* Modes for retasking pin widgets |
| 4802 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4803 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4804 | * mention this restriction. At this stage it's not clear whether |
| 4805 | * this behaviour is intentional or is a hardware bug in chip |
| 4806 | * revisions available at least up until early 2006. Therefore for |
| 4807 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4808 | * choices, but if it turns out that the lack of mic bias for these |
| 4809 | * NIDs is intentional we could change their modes from |
| 4810 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4811 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4812 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4813 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4814 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4815 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4816 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4817 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4818 | |
| 4819 | /* Loopback mixer controls */ |
| 4820 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4821 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4822 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4823 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4824 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4825 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4826 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4827 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4828 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4829 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4830 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4831 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4832 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4833 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4834 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4835 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4836 | |
| 4837 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4838 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4839 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4840 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4841 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4842 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4843 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4844 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4845 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4846 | */ |
| 4847 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4848 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4849 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4850 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4851 | * this output to turn on an external amplifier. |
| 4852 | */ |
| 4853 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4854 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4855 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4856 | { } /* end */ |
| 4857 | }; |
| 4858 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4859 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4860 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4861 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4862 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4863 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4864 | /* Enable retasking pins as output, initially without power amp */ |
| 4865 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4866 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4867 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4868 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4869 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4870 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4871 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4872 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4873 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4874 | * payload also sets the generation to 0, output to be in "consumer" |
| 4875 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4876 | * control. |
| 4877 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4878 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4879 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4880 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4881 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4882 | * OUT1 sum bus when acting as an output. |
| 4883 | */ |
| 4884 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4885 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4886 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4887 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4888 | |
| 4889 | /* Start with output sum widgets muted and their output gains at min */ |
| 4890 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4891 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4892 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4893 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4894 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4895 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4896 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4897 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4898 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4899 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4900 | /* Unmute retasking pin widget output buffers since the default |
| 4901 | * state appears to be output. As the pin mode is changed by the |
| 4902 | * user the pin mode control will take care of enabling the pin's |
| 4903 | * input/output buffers as needed. |
| 4904 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4905 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4906 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4907 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4908 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4909 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4910 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4911 | /* Also unmute the mono-out pin widget */ |
| 4912 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4913 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4914 | /* Mute capture amp left and right */ |
| 4915 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4916 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4917 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4918 | */ |
| 4919 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4920 | |
| 4921 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4922 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4923 | */ |
| 4924 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4925 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4926 | |
| 4927 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4929 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4930 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4931 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4932 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4933 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4934 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4935 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4936 | |
| 4937 | { } |
| 4938 | }; |
| 4939 | #endif |
| 4940 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4941 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4942 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4943 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4944 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4945 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4946 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4947 | /* |
| 4948 | * for BIOS auto-configuration |
| 4949 | */ |
| 4950 | |
| 4951 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4952 | const char *pfx) |
| 4953 | { |
| 4954 | hda_nid_t nid_vol; |
| 4955 | unsigned long vol_val, sw_val; |
| 4956 | char name[32]; |
| 4957 | int err; |
| 4958 | |
| 4959 | if (nid >= 0x0f && nid < 0x11) { |
| 4960 | nid_vol = nid - 0x7; |
| 4961 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4962 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4963 | } else if (nid == 0x11) { |
| 4964 | nid_vol = nid - 0x7; |
| 4965 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4966 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4967 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4968 | nid_vol = 0x08; |
| 4969 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4970 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4971 | } else |
| 4972 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4973 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4974 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4975 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4976 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4977 | return err; |
| 4978 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4979 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4980 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4981 | return err; |
| 4982 | return 1; |
| 4983 | } |
| 4984 | |
| 4985 | /* add playback controls from the parsed DAC table */ |
| 4986 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4987 | const struct auto_pin_cfg *cfg) |
| 4988 | { |
| 4989 | hda_nid_t nid; |
| 4990 | int err; |
| 4991 | |
| 4992 | spec->multiout.num_dacs = 1; |
| 4993 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4994 | spec->multiout.dac_nids[0] = 0x02; |
| 4995 | |
| 4996 | nid = cfg->line_out_pins[0]; |
| 4997 | if (nid) { |
| 4998 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4999 | if (err < 0) |
| 5000 | return err; |
| 5001 | } |
| 5002 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5003 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5004 | if (nid) { |
| 5005 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 5006 | if (err < 0) |
| 5007 | return err; |
| 5008 | } |
| 5009 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5010 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5011 | if (nid) { |
| 5012 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 5013 | if (err < 0) |
| 5014 | return err; |
| 5015 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5016 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5017 | } |
| 5018 | |
| 5019 | /* create playback/capture controls for input pins */ |
| 5020 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5021 | const struct auto_pin_cfg *cfg) |
| 5022 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5023 | struct hda_input_mux *imux = &spec->private_imux; |
| 5024 | int i, err, idx; |
| 5025 | |
| 5026 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5027 | if (cfg->input_pins[i] >= 0x12) { |
| 5028 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5029 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5030 | auto_pin_cfg_labels[i], idx, |
| 5031 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5032 | if (err < 0) |
| 5033 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5034 | imux->items[imux->num_items].label = |
| 5035 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5036 | imux->items[imux->num_items].index = idx; |
| 5037 | imux->num_items++; |
| 5038 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5039 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5040 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5041 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5042 | auto_pin_cfg_labels[i], idx, |
| 5043 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5044 | if (err < 0) |
| 5045 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5046 | imux->items[imux->num_items].label = |
| 5047 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5048 | imux->items[imux->num_items].index = idx; |
| 5049 | imux->num_items++; |
| 5050 | } |
| 5051 | } |
| 5052 | return 0; |
| 5053 | } |
| 5054 | |
| 5055 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5056 | hda_nid_t nid, int pin_type, |
| 5057 | int sel_idx) |
| 5058 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5059 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5060 | /* need the manual connection? */ |
| 5061 | if (nid >= 0x12) { |
| 5062 | int idx = nid - 0x12; |
| 5063 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5064 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5065 | } |
| 5066 | } |
| 5067 | |
| 5068 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5069 | { |
| 5070 | struct alc_spec *spec = codec->spec; |
| 5071 | hda_nid_t nid; |
| 5072 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5073 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5074 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5075 | if (nid) { |
| 5076 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5077 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5078 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5079 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5080 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5081 | if (nid) |
| 5082 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5083 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5084 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5085 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5086 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5087 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5088 | |
| 5089 | #define ALC260_PIN_CD_NID 0x16 |
| 5090 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5091 | { |
| 5092 | struct alc_spec *spec = codec->spec; |
| 5093 | int i; |
| 5094 | |
| 5095 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5096 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5097 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5098 | snd_hda_codec_write(codec, nid, 0, |
| 5099 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5100 | i <= AUTO_PIN_FRONT_MIC ? |
| 5101 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5102 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5103 | snd_hda_codec_write(codec, nid, 0, |
| 5104 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5105 | AMP_OUT_MUTE); |
| 5106 | } |
| 5107 | } |
| 5108 | } |
| 5109 | |
| 5110 | /* |
| 5111 | * generic initialization of ADC, input mixers and output mixers |
| 5112 | */ |
| 5113 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5114 | /* |
| 5115 | * Unmute ADC0-1 and set the default input to mic-in |
| 5116 | */ |
| 5117 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5118 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5119 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5120 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5121 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5122 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5123 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5124 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5125 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5126 | */ |
| 5127 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5128 | /* mute analog inputs */ |
| 5129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5133 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5134 | |
| 5135 | /* |
| 5136 | * Set up output mixers (0x08 - 0x0a) |
| 5137 | */ |
| 5138 | /* set vol=0 to output mixers */ |
| 5139 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5140 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5141 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5142 | /* set up input amps for analog loopback */ |
| 5143 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5144 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5145 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5146 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5147 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5148 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5149 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5150 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5151 | { } |
| 5152 | }; |
| 5153 | |
| 5154 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5155 | { |
| 5156 | struct alc_spec *spec = codec->spec; |
| 5157 | unsigned int wcap; |
| 5158 | int err; |
| 5159 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5160 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5161 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5162 | alc260_ignore); |
| 5163 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5164 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5165 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5166 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5167 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5168 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5169 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5170 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5171 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5172 | return err; |
| 5173 | |
| 5174 | spec->multiout.max_channels = 2; |
| 5175 | |
| 5176 | if (spec->autocfg.dig_out_pin) |
| 5177 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 5178 | if (spec->kctl_alloc) |
| 5179 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 5180 | |
| 5181 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 5182 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5183 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5184 | spec->input_mux = &spec->private_imux; |
| 5185 | |
| 5186 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5187 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5188 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 5189 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5190 | spec->adc_nids = alc260_adc_nids_alt; |
| 5191 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5192 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5193 | } else { |
| 5194 | spec->adc_nids = alc260_adc_nids; |
| 5195 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5196 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5197 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5198 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5199 | |
| 5200 | return 1; |
| 5201 | } |
| 5202 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5203 | /* additional initialization for auto-configuration model */ |
| 5204 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5205 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5206 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5207 | alc260_auto_init_multi_out(codec); |
| 5208 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5209 | if (spec->unsol_event) |
| 5210 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5211 | } |
| 5212 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5213 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5214 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5215 | { 0x07, HDA_INPUT, 0 }, |
| 5216 | { 0x07, HDA_INPUT, 1 }, |
| 5217 | { 0x07, HDA_INPUT, 2 }, |
| 5218 | { 0x07, HDA_INPUT, 3 }, |
| 5219 | { 0x07, HDA_INPUT, 4 }, |
| 5220 | { } /* end */ |
| 5221 | }; |
| 5222 | #endif |
| 5223 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5224 | /* |
| 5225 | * ALC260 configurations |
| 5226 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5227 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5228 | [ALC260_BASIC] = "basic", |
| 5229 | [ALC260_HP] = "hp", |
| 5230 | [ALC260_HP_3013] = "hp-3013", |
| 5231 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5232 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5233 | [ALC260_WILL] = "will", |
| 5234 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5235 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5236 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5237 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5238 | [ALC260_AUTO] = "auto", |
| 5239 | }; |
| 5240 | |
| 5241 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5242 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5243 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5244 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5245 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5246 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5247 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5248 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5249 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5250 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5251 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5252 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5253 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5254 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5255 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5256 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5257 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5258 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5259 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5260 | {} |
| 5261 | }; |
| 5262 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5263 | static struct alc_config_preset alc260_presets[] = { |
| 5264 | [ALC260_BASIC] = { |
| 5265 | .mixers = { alc260_base_output_mixer, |
| 5266 | alc260_input_mixer, |
| 5267 | alc260_pc_beep_mixer, |
| 5268 | alc260_capture_mixer }, |
| 5269 | .init_verbs = { alc260_init_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 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5275 | .channel_mode = alc260_modes, |
| 5276 | .input_mux = &alc260_capture_source, |
| 5277 | }, |
| 5278 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5279 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5280 | alc260_input_mixer, |
| 5281 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5282 | .init_verbs = { alc260_init_verbs, |
| 5283 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5284 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5285 | .dac_nids = alc260_dac_nids, |
| 5286 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5287 | .adc_nids = alc260_hp_adc_nids, |
| 5288 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5289 | .channel_mode = alc260_modes, |
| 5290 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5291 | .unsol_event = alc260_hp_unsol_event, |
| 5292 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5293 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5294 | [ALC260_HP_DC7600] = { |
| 5295 | .mixers = { alc260_hp_dc7600_mixer, |
| 5296 | alc260_input_mixer, |
| 5297 | alc260_capture_alt_mixer }, |
| 5298 | .init_verbs = { alc260_init_verbs, |
| 5299 | alc260_hp_dc7600_verbs }, |
| 5300 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5301 | .dac_nids = alc260_dac_nids, |
| 5302 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5303 | .adc_nids = alc260_hp_adc_nids, |
| 5304 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5305 | .channel_mode = alc260_modes, |
| 5306 | .input_mux = &alc260_capture_source, |
| 5307 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5308 | .init_hook = alc260_hp_3012_automute, |
| 5309 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5310 | [ALC260_HP_3013] = { |
| 5311 | .mixers = { alc260_hp_3013_mixer, |
| 5312 | alc260_input_mixer, |
| 5313 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5314 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5315 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5316 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5317 | .dac_nids = alc260_dac_nids, |
| 5318 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5319 | .adc_nids = alc260_hp_adc_nids, |
| 5320 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5321 | .channel_mode = alc260_modes, |
| 5322 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5323 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5324 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5325 | }, |
| 5326 | [ALC260_FUJITSU_S702X] = { |
| 5327 | .mixers = { alc260_fujitsu_mixer, |
| 5328 | alc260_capture_mixer }, |
| 5329 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5330 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5331 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5332 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5333 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5334 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5335 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5336 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5337 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5338 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5339 | [ALC260_ACER] = { |
| 5340 | .mixers = { alc260_acer_mixer, |
| 5341 | alc260_capture_mixer }, |
| 5342 | .init_verbs = { alc260_acer_init_verbs }, |
| 5343 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5344 | .dac_nids = alc260_dac_nids, |
| 5345 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5346 | .adc_nids = alc260_dual_adc_nids, |
| 5347 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5348 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5349 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5350 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5351 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5352 | [ALC260_WILL] = { |
| 5353 | .mixers = { alc260_will_mixer, |
| 5354 | alc260_capture_mixer }, |
| 5355 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5356 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5357 | .dac_nids = alc260_dac_nids, |
| 5358 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5359 | .adc_nids = alc260_adc_nids, |
| 5360 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5361 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5362 | .channel_mode = alc260_modes, |
| 5363 | .input_mux = &alc260_capture_source, |
| 5364 | }, |
| 5365 | [ALC260_REPLACER_672V] = { |
| 5366 | .mixers = { alc260_replacer_672v_mixer, |
| 5367 | alc260_capture_mixer }, |
| 5368 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5369 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5370 | .dac_nids = alc260_dac_nids, |
| 5371 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5372 | .adc_nids = alc260_adc_nids, |
| 5373 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5374 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5375 | .channel_mode = alc260_modes, |
| 5376 | .input_mux = &alc260_capture_source, |
| 5377 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5378 | .init_hook = alc260_replacer_672v_automute, |
| 5379 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5380 | #ifdef CONFIG_SND_DEBUG |
| 5381 | [ALC260_TEST] = { |
| 5382 | .mixers = { alc260_test_mixer, |
| 5383 | alc260_capture_mixer }, |
| 5384 | .init_verbs = { alc260_test_init_verbs }, |
| 5385 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5386 | .dac_nids = alc260_test_dac_nids, |
| 5387 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5388 | .adc_nids = alc260_test_adc_nids, |
| 5389 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5390 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5391 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5392 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5393 | }, |
| 5394 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5395 | }; |
| 5396 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5397 | static int patch_alc260(struct hda_codec *codec) |
| 5398 | { |
| 5399 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5400 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5401 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5402 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5403 | if (spec == NULL) |
| 5404 | return -ENOMEM; |
| 5405 | |
| 5406 | codec->spec = spec; |
| 5407 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5408 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5409 | alc260_models, |
| 5410 | alc260_cfg_tbl); |
| 5411 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5412 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5413 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5414 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5415 | } |
| 5416 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5417 | if (board_config == ALC260_AUTO) { |
| 5418 | /* automatic parse from the BIOS config */ |
| 5419 | err = alc260_parse_auto_config(codec); |
| 5420 | if (err < 0) { |
| 5421 | alc_free(codec); |
| 5422 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5423 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5424 | printk(KERN_INFO |
| 5425 | "hda_codec: Cannot set up configuration " |
| 5426 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5427 | board_config = ALC260_BASIC; |
| 5428 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5429 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5430 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5431 | if (board_config != ALC260_AUTO) |
| 5432 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5433 | |
| 5434 | spec->stream_name_analog = "ALC260 Analog"; |
| 5435 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5436 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5437 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5438 | spec->stream_name_digital = "ALC260 Digital"; |
| 5439 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5440 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5441 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5442 | spec->vmaster_nid = 0x08; |
| 5443 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5444 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5445 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5446 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5447 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5448 | if (!spec->loopback.amplist) |
| 5449 | spec->loopback.amplist = alc260_loopbacks; |
| 5450 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5451 | |
| 5452 | return 0; |
| 5453 | } |
| 5454 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5455 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5456 | /* |
| 5457 | * ALC882 support |
| 5458 | * |
| 5459 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5460 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5461 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5462 | * 6-channel independent captures. |
| 5463 | * |
| 5464 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5465 | * driver yet). |
| 5466 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5467 | #define ALC882_DIGOUT_NID 0x06 |
| 5468 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5469 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5470 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5471 | { 8, NULL } |
| 5472 | }; |
| 5473 | |
| 5474 | static hda_nid_t alc882_dac_nids[4] = { |
| 5475 | /* front, rear, clfe, rear_surr */ |
| 5476 | 0x02, 0x03, 0x04, 0x05 |
| 5477 | }; |
| 5478 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5479 | /* identical with ALC880 */ |
| 5480 | #define alc882_adc_nids alc880_adc_nids |
| 5481 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5482 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5483 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5484 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5485 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5486 | /* input MUX */ |
| 5487 | /* FIXME: should be a matrix-type input source selection */ |
| 5488 | |
| 5489 | static struct hda_input_mux alc882_capture_source = { |
| 5490 | .num_items = 4, |
| 5491 | .items = { |
| 5492 | { "Mic", 0x0 }, |
| 5493 | { "Front Mic", 0x1 }, |
| 5494 | { "Line", 0x2 }, |
| 5495 | { "CD", 0x4 }, |
| 5496 | }, |
| 5497 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5498 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5499 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5500 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5501 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5502 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5503 | { |
| 5504 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5505 | struct alc_spec *spec = codec->spec; |
| 5506 | const struct hda_input_mux *imux = spec->input_mux; |
| 5507 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5508 | hda_nid_t nid = spec->capsrc_nids ? |
| 5509 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5510 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5511 | unsigned int i, idx; |
| 5512 | |
| 5513 | idx = ucontrol->value.enumerated.item[0]; |
| 5514 | if (idx >= imux->num_items) |
| 5515 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5516 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5517 | return 0; |
| 5518 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5519 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5520 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5521 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5522 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5523 | } |
| 5524 | *cur_val = idx; |
| 5525 | return 1; |
| 5526 | } |
| 5527 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5528 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5529 | * 2ch mode |
| 5530 | */ |
| 5531 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5532 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5533 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5534 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5535 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5536 | { } /* end */ |
| 5537 | }; |
| 5538 | |
| 5539 | /* |
| 5540 | * 6ch mode |
| 5541 | */ |
| 5542 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5543 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5544 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5545 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5546 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5547 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5548 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5549 | { } /* end */ |
| 5550 | }; |
| 5551 | |
| 5552 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5553 | { 2, alc882_3ST_ch2_init }, |
| 5554 | { 6, alc882_3ST_ch6_init }, |
| 5555 | }; |
| 5556 | |
| 5557 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5558 | * 6ch mode |
| 5559 | */ |
| 5560 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5561 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5562 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5563 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5564 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5565 | { } /* end */ |
| 5566 | }; |
| 5567 | |
| 5568 | /* |
| 5569 | * 8ch mode |
| 5570 | */ |
| 5571 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5572 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5573 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5574 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5575 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5576 | { } /* end */ |
| 5577 | }; |
| 5578 | |
| 5579 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5580 | { 6, alc882_sixstack_ch6_init }, |
| 5581 | { 8, alc882_sixstack_ch8_init }, |
| 5582 | }; |
| 5583 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5584 | /* |
| 5585 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5586 | */ |
| 5587 | |
| 5588 | /* |
| 5589 | * 2ch mode |
| 5590 | */ |
| 5591 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5592 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5593 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5594 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5595 | { } /* end */ |
| 5596 | }; |
| 5597 | |
| 5598 | /* |
| 5599 | * 6ch mode |
| 5600 | */ |
| 5601 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5602 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5603 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5604 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5605 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5606 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5607 | { } /* end */ |
| 5608 | }; |
| 5609 | |
| 5610 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5611 | { 2, alc885_mbp_ch2_init }, |
| 5612 | { 6, alc885_mbp_ch6_init }, |
| 5613 | }; |
| 5614 | |
| 5615 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5616 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5617 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5618 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5619 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5620 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5621 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5622 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5623 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5624 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5625 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5626 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5627 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5628 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5629 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5630 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5631 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5632 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5633 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5634 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5635 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5636 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5637 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5638 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5639 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5640 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5641 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5642 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5643 | { } /* end */ |
| 5644 | }; |
| 5645 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5646 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5647 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5648 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5649 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5650 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5651 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5652 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5653 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5654 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5655 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5656 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5657 | { } /* end */ |
| 5658 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5659 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5660 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5661 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5662 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5663 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5664 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5665 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5666 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5667 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5668 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5669 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5670 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5671 | { } /* end */ |
| 5672 | }; |
| 5673 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5674 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5675 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5676 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5677 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5678 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5679 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5680 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5681 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5682 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5683 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5684 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5685 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5686 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5687 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5688 | { } /* end */ |
| 5689 | }; |
| 5690 | |
| 5691 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5692 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5693 | */ |
| 5694 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5695 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5696 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5697 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5698 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5699 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5700 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5701 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5702 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5703 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5704 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5705 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5706 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5707 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5708 | { } /* end */ |
| 5709 | }; |
| 5710 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5711 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5712 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5713 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5714 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5715 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5716 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5717 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5718 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5719 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5720 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5721 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5722 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5723 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5724 | { } /* end */ |
| 5725 | }; |
| 5726 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5727 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5728 | { |
| 5729 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5730 | .name = "Channel Mode", |
| 5731 | .info = alc_ch_mode_info, |
| 5732 | .get = alc_ch_mode_get, |
| 5733 | .put = alc_ch_mode_put, |
| 5734 | }, |
| 5735 | { } /* end */ |
| 5736 | }; |
| 5737 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5738 | static struct hda_verb alc882_init_verbs[] = { |
| 5739 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5740 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5741 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5742 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5743 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5744 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5745 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5746 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5747 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5748 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5749 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5750 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5751 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5752 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5753 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5754 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5755 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5756 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5757 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5758 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5759 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5760 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5761 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5762 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5763 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5764 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5765 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5766 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5767 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5768 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5769 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5770 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5771 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5772 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5773 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5774 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5775 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5776 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5777 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5778 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5779 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5780 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5781 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5782 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5783 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5784 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5785 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5786 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5787 | |
| 5788 | /* FIXME: use matrix-type input source selection */ |
| 5789 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5790 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5791 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5792 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5793 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5794 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5795 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5796 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5797 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5798 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5799 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5800 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5801 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5802 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5803 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5804 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5805 | /* ADC1: mute amp left and right */ |
| 5806 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5807 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5808 | /* ADC2: mute amp left and right */ |
| 5809 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5810 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5811 | /* ADC3: mute amp left and right */ |
| 5812 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5813 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5814 | |
| 5815 | { } |
| 5816 | }; |
| 5817 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5818 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5819 | /* change to EAPD mode */ |
| 5820 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5821 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5822 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5823 | }; |
| 5824 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5825 | /* Mac Pro test */ |
| 5826 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5827 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5828 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5829 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5830 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5831 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5832 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5833 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5834 | { } /* end */ |
| 5835 | }; |
| 5836 | |
| 5837 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5838 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5839 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5840 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5841 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5842 | /* Front Pin: output 0 (0x0c) */ |
| 5843 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5844 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5845 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5846 | /* Front Mic pin: input vref at 80% */ |
| 5847 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5848 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5849 | /* Speaker: output */ |
| 5850 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5851 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5852 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5853 | /* Headphone output (output 0 - 0x0c) */ |
| 5854 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5855 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5856 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5857 | |
| 5858 | /* FIXME: use matrix-type input source selection */ |
| 5859 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5860 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5861 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5862 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5863 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5864 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5865 | /* Input mixer2 */ |
| 5866 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5867 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5868 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5869 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5870 | /* Input mixer3 */ |
| 5871 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5872 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5873 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5874 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5875 | /* ADC1: mute amp left and right */ |
| 5876 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5877 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5878 | /* ADC2: mute amp left and right */ |
| 5879 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5880 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5881 | /* ADC3: mute amp left and right */ |
| 5882 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5883 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5884 | |
| 5885 | { } |
| 5886 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5887 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5888 | /* Macbook Pro rev3 */ |
| 5889 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5890 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5891 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5892 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5893 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5894 | /* Rear mixer */ |
| 5895 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5896 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5897 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5898 | /* Front Pin: output 0 (0x0c) */ |
| 5899 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5900 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5901 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5902 | /* HP Pin: output 0 (0x0d) */ |
| 5903 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5904 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5905 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5906 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5907 | /* Mic (rear) pin: input vref at 80% */ |
| 5908 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5909 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5910 | /* Front Mic pin: input vref at 80% */ |
| 5911 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5912 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5913 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5914 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5915 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5916 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5917 | |
| 5918 | /* FIXME: use matrix-type input source selection */ |
| 5919 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5920 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5921 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5922 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5923 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5924 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5925 | /* Input mixer2 */ |
| 5926 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5927 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5928 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5929 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5930 | /* Input mixer3 */ |
| 5931 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5932 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5933 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5934 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5935 | /* ADC1: mute amp left and right */ |
| 5936 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5937 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5938 | /* ADC2: mute amp left and right */ |
| 5939 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5940 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5941 | /* ADC3: mute amp left and right */ |
| 5942 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5943 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5944 | |
| 5945 | { } |
| 5946 | }; |
| 5947 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5948 | /* iMac 24 mixer. */ |
| 5949 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5950 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5951 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5952 | { } /* end */ |
| 5953 | }; |
| 5954 | |
| 5955 | /* iMac 24 init verbs. */ |
| 5956 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5957 | /* Internal speakers: output 0 (0x0c) */ |
| 5958 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5959 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5960 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5961 | /* Internal speakers: output 0 (0x0c) */ |
| 5962 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5963 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5964 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5965 | /* Headphone: output 0 (0x0c) */ |
| 5966 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5967 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5968 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5969 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5970 | /* Front Mic: input vref at 80% */ |
| 5971 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5972 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5973 | { } |
| 5974 | }; |
| 5975 | |
| 5976 | /* Toggle speaker-output according to the hp-jack state */ |
| 5977 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5978 | { |
| 5979 | unsigned int present; |
| 5980 | |
| 5981 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5982 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5983 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5984 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5985 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5986 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5987 | } |
| 5988 | |
| 5989 | /* Processes unsolicited events. */ |
| 5990 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5991 | unsigned int res) |
| 5992 | { |
| 5993 | /* Headphone insertion or removal. */ |
| 5994 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5995 | alc885_imac24_automute(codec); |
| 5996 | } |
| 5997 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5998 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5999 | { |
| 6000 | unsigned int present; |
| 6001 | |
| 6002 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6003 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6004 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6005 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6006 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6007 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6008 | |
| 6009 | } |
| 6010 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6011 | unsigned int res) |
| 6012 | { |
| 6013 | /* Headphone insertion or removal. */ |
| 6014 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6015 | alc885_mbp3_automute(codec); |
| 6016 | } |
| 6017 | |
| 6018 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6019 | static struct hda_verb alc882_targa_verbs[] = { |
| 6020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6021 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6022 | |
| 6023 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6024 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6025 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6026 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6027 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6028 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6029 | |
| 6030 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6031 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6032 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6033 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6034 | { } /* end */ |
| 6035 | }; |
| 6036 | |
| 6037 | /* toggle speaker-output according to the hp-jack state */ |
| 6038 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6039 | { |
| 6040 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6041 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6042 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6043 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6044 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6045 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6046 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6047 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6048 | } |
| 6049 | |
| 6050 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6051 | { |
| 6052 | /* Looks like the unsol event is incompatible with the standard |
| 6053 | * definition. 4bit tag is placed at 26 bit! |
| 6054 | */ |
| 6055 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6056 | alc882_targa_automute(codec); |
| 6057 | } |
| 6058 | } |
| 6059 | |
| 6060 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6061 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6062 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6063 | |
| 6064 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6065 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6066 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6067 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6068 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6069 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6070 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6071 | |
| 6072 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6073 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6074 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6075 | { } /* end */ |
| 6076 | }; |
| 6077 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6078 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6079 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6080 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6081 | |
| 6082 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6083 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6084 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6085 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6086 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6087 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6088 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6089 | |
| 6090 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6091 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6092 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6093 | { } /* end */ |
| 6094 | }; |
| 6095 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6096 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6097 | { |
| 6098 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6099 | |
| 6100 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6101 | AC_VERB_GET_GPIO_DATA, 0); |
| 6102 | |
| 6103 | if (!muted) |
| 6104 | gpiostate |= (1 << pin); |
| 6105 | else |
| 6106 | gpiostate &= ~(1 << pin); |
| 6107 | |
| 6108 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6109 | AC_VERB_GET_GPIO_MASK, 0); |
| 6110 | gpiomask |= (1 << pin); |
| 6111 | |
| 6112 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6113 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6114 | gpiodir |= (1 << pin); |
| 6115 | |
| 6116 | |
| 6117 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6118 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6119 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6120 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6121 | |
| 6122 | msleep(1); |
| 6123 | |
| 6124 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6125 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6126 | } |
| 6127 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6128 | /* set up GPIO at initialization */ |
| 6129 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6130 | { |
| 6131 | alc882_gpio_mute(codec, 0, 0); |
| 6132 | alc882_gpio_mute(codec, 1, 0); |
| 6133 | } |
| 6134 | |
| 6135 | /* set up GPIO and update auto-muting at initialization */ |
| 6136 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6137 | { |
| 6138 | alc885_macpro_init_hook(codec); |
| 6139 | alc885_imac24_automute(codec); |
| 6140 | } |
| 6141 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6142 | /* |
| 6143 | * generic initialization of ADC, input mixers and output mixers |
| 6144 | */ |
| 6145 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6146 | /* |
| 6147 | * Unmute ADC0-2 and set the default input to mic-in |
| 6148 | */ |
| 6149 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6150 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6151 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6152 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6153 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6154 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6155 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6156 | /* 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] | 6157 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6158 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6159 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6160 | */ |
| 6161 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6162 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6163 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6164 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6165 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6166 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6167 | |
| 6168 | /* |
| 6169 | * Set up output mixers (0x0c - 0x0f) |
| 6170 | */ |
| 6171 | /* set vol=0 to output mixers */ |
| 6172 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6173 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6174 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6175 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6176 | /* set up input amps for analog loopback */ |
| 6177 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6178 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6179 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6180 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6181 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6182 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6183 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6184 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6185 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6186 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6187 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6188 | |
| 6189 | /* FIXME: use matrix-type input source selection */ |
| 6190 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6191 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6192 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6195 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6196 | /* Input mixer2 */ |
| 6197 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6198 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6199 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6200 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6201 | /* Input mixer3 */ |
| 6202 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6203 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6204 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6205 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6206 | |
| 6207 | { } |
| 6208 | }; |
| 6209 | |
| 6210 | /* capture mixer elements */ |
| 6211 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 6212 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6213 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6214 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6215 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6216 | { |
| 6217 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6218 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6219 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6220 | */ |
| 6221 | /* .name = "Capture Source", */ |
| 6222 | .name = "Input Source", |
| 6223 | .count = 2, |
| 6224 | .info = alc882_mux_enum_info, |
| 6225 | .get = alc882_mux_enum_get, |
| 6226 | .put = alc882_mux_enum_put, |
| 6227 | }, |
| 6228 | { } /* end */ |
| 6229 | }; |
| 6230 | |
| 6231 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 6232 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 6233 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 6234 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 6235 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 6236 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 6237 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 6238 | { |
| 6239 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6240 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6241 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6242 | */ |
| 6243 | /* .name = "Capture Source", */ |
| 6244 | .name = "Input Source", |
| 6245 | .count = 3, |
| 6246 | .info = alc882_mux_enum_info, |
| 6247 | .get = alc882_mux_enum_get, |
| 6248 | .put = alc882_mux_enum_put, |
| 6249 | }, |
| 6250 | { } /* end */ |
| 6251 | }; |
| 6252 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6253 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6254 | #define alc882_loopbacks alc880_loopbacks |
| 6255 | #endif |
| 6256 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6257 | /* pcm configuration: identiacal with ALC880 */ |
| 6258 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6259 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6260 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6261 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6262 | |
| 6263 | /* |
| 6264 | * configuration and preset |
| 6265 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6266 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6267 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6268 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6269 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6270 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6271 | [ALC882_TARGA] = "targa", |
| 6272 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6273 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6274 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6275 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6276 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6277 | [ALC882_AUTO] = "auto", |
| 6278 | }; |
| 6279 | |
| 6280 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6281 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6282 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6283 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6284 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6285 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6286 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6287 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6288 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6289 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6290 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6291 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6292 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6293 | {} |
| 6294 | }; |
| 6295 | |
| 6296 | static struct alc_config_preset alc882_presets[] = { |
| 6297 | [ALC882_3ST_DIG] = { |
| 6298 | .mixers = { alc882_base_mixer }, |
| 6299 | .init_verbs = { alc882_init_verbs }, |
| 6300 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6301 | .dac_nids = alc882_dac_nids, |
| 6302 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6303 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6304 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6305 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6306 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6307 | .input_mux = &alc882_capture_source, |
| 6308 | }, |
| 6309 | [ALC882_6ST_DIG] = { |
| 6310 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6311 | .init_verbs = { alc882_init_verbs }, |
| 6312 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6313 | .dac_nids = alc882_dac_nids, |
| 6314 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6315 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6316 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6317 | .channel_mode = alc882_sixstack_modes, |
| 6318 | .input_mux = &alc882_capture_source, |
| 6319 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6320 | [ALC882_ARIMA] = { |
| 6321 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6322 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6323 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6324 | .dac_nids = alc882_dac_nids, |
| 6325 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6326 | .channel_mode = alc882_sixstack_modes, |
| 6327 | .input_mux = &alc882_capture_source, |
| 6328 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6329 | [ALC882_W2JC] = { |
| 6330 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6331 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6332 | alc880_gpio1_init_verbs }, |
| 6333 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6334 | .dac_nids = alc882_dac_nids, |
| 6335 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6336 | .channel_mode = alc880_threestack_modes, |
| 6337 | .need_dac_fix = 1, |
| 6338 | .input_mux = &alc882_capture_source, |
| 6339 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6340 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6341 | [ALC885_MBP3] = { |
| 6342 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6343 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6344 | alc880_gpio1_init_verbs }, |
| 6345 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6346 | .dac_nids = alc882_dac_nids, |
| 6347 | .channel_mode = alc885_mbp_6ch_modes, |
| 6348 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6349 | .input_mux = &alc882_capture_source, |
| 6350 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6351 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6352 | .unsol_event = alc885_mbp3_unsol_event, |
| 6353 | .init_hook = alc885_mbp3_automute, |
| 6354 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6355 | [ALC885_MACPRO] = { |
| 6356 | .mixers = { alc882_macpro_mixer }, |
| 6357 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6358 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6359 | .dac_nids = alc882_dac_nids, |
| 6360 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6361 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6362 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6363 | .channel_mode = alc882_ch_modes, |
| 6364 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6365 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6366 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6367 | [ALC885_IMAC24] = { |
| 6368 | .mixers = { alc885_imac24_mixer }, |
| 6369 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6370 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6371 | .dac_nids = alc882_dac_nids, |
| 6372 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6373 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6374 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6375 | .channel_mode = alc882_ch_modes, |
| 6376 | .input_mux = &alc882_capture_source, |
| 6377 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6378 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6379 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6380 | [ALC882_TARGA] = { |
| 6381 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6382 | alc882_capture_mixer }, |
| 6383 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6384 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6385 | .dac_nids = alc882_dac_nids, |
| 6386 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6387 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6388 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6389 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6390 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6391 | .channel_mode = alc882_3ST_6ch_modes, |
| 6392 | .need_dac_fix = 1, |
| 6393 | .input_mux = &alc882_capture_source, |
| 6394 | .unsol_event = alc882_targa_unsol_event, |
| 6395 | .init_hook = alc882_targa_automute, |
| 6396 | }, |
| 6397 | [ALC882_ASUS_A7J] = { |
| 6398 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6399 | alc882_capture_mixer }, |
| 6400 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6401 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6402 | .dac_nids = alc882_dac_nids, |
| 6403 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6404 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6405 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6406 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6407 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6408 | .channel_mode = alc882_3ST_6ch_modes, |
| 6409 | .need_dac_fix = 1, |
| 6410 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6411 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6412 | [ALC882_ASUS_A7M] = { |
| 6413 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6414 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6415 | alc880_gpio1_init_verbs, |
| 6416 | alc882_asus_a7m_verbs }, |
| 6417 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6418 | .dac_nids = alc882_dac_nids, |
| 6419 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6420 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6421 | .channel_mode = alc880_threestack_modes, |
| 6422 | .need_dac_fix = 1, |
| 6423 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6424 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6425 | }; |
| 6426 | |
| 6427 | |
| 6428 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6429 | * Pin config fixes |
| 6430 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6431 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6432 | PINFIX_ABIT_AW9D_MAX |
| 6433 | }; |
| 6434 | |
| 6435 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6436 | { 0x15, 0x01080104 }, /* side */ |
| 6437 | { 0x16, 0x01011012 }, /* rear */ |
| 6438 | { 0x17, 0x01016011 }, /* clfe */ |
| 6439 | { } |
| 6440 | }; |
| 6441 | |
| 6442 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6443 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6444 | }; |
| 6445 | |
| 6446 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6447 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6448 | {} |
| 6449 | }; |
| 6450 | |
| 6451 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6452 | * BIOS auto configuration |
| 6453 | */ |
| 6454 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6455 | hda_nid_t nid, int pin_type, |
| 6456 | int dac_idx) |
| 6457 | { |
| 6458 | /* set as output */ |
| 6459 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6460 | int idx; |
| 6461 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6462 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6463 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6464 | idx = 4; |
| 6465 | else |
| 6466 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6467 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6468 | |
| 6469 | } |
| 6470 | |
| 6471 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6472 | { |
| 6473 | struct alc_spec *spec = codec->spec; |
| 6474 | int i; |
| 6475 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6476 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6477 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6478 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6479 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6480 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6481 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6482 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6483 | } |
| 6484 | } |
| 6485 | |
| 6486 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6487 | { |
| 6488 | struct alc_spec *spec = codec->spec; |
| 6489 | hda_nid_t pin; |
| 6490 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6491 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6492 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6493 | /* use dac 0 */ |
| 6494 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6495 | pin = spec->autocfg.speaker_pins[0]; |
| 6496 | if (pin) |
| 6497 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6498 | } |
| 6499 | |
| 6500 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6501 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6502 | |
| 6503 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6504 | { |
| 6505 | struct alc_spec *spec = codec->spec; |
| 6506 | int i; |
| 6507 | |
| 6508 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6509 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6510 | unsigned int vref; |
| 6511 | if (!nid) |
| 6512 | continue; |
| 6513 | vref = PIN_IN; |
| 6514 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6515 | unsigned int pincap; |
| 6516 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6517 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6518 | AC_PINCAP_VREF_80) |
| 6519 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6520 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6521 | snd_hda_codec_write(codec, nid, 0, |
| 6522 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6523 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6524 | snd_hda_codec_write(codec, nid, 0, |
| 6525 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6526 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6527 | } |
| 6528 | } |
| 6529 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6530 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 6531 | { |
| 6532 | struct alc_spec *spec = codec->spec; |
| 6533 | const struct hda_input_mux *imux = spec->input_mux; |
| 6534 | int c; |
| 6535 | |
| 6536 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 6537 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 6538 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 6539 | int conns, mute, idx, item; |
| 6540 | |
| 6541 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 6542 | ARRAY_SIZE(conn_list)); |
| 6543 | if (conns < 0) |
| 6544 | continue; |
| 6545 | for (idx = 0; idx < conns; idx++) { |
| 6546 | /* if the current connection is the selected one, |
| 6547 | * unmute it as default - otherwise mute it |
| 6548 | */ |
| 6549 | mute = AMP_IN_MUTE(idx); |
| 6550 | for (item = 0; item < imux->num_items; item++) { |
| 6551 | if (imux->items[item].index == idx) { |
| 6552 | if (spec->cur_mux[c] == item) |
| 6553 | mute = AMP_IN_UNMUTE(idx); |
| 6554 | break; |
| 6555 | } |
| 6556 | } |
| 6557 | snd_hda_codec_write(codec, nid, 0, |
| 6558 | AC_VERB_SET_AMP_GAIN_MUTE, mute); |
| 6559 | } |
| 6560 | } |
| 6561 | } |
| 6562 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6563 | /* add mic boosts if needed */ |
| 6564 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6565 | { |
| 6566 | struct alc_spec *spec = codec->spec; |
| 6567 | int err; |
| 6568 | hda_nid_t nid; |
| 6569 | |
| 6570 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6571 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6572 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6573 | "Mic Boost", |
| 6574 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6575 | if (err < 0) |
| 6576 | return err; |
| 6577 | } |
| 6578 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6579 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6580 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6581 | "Front Mic Boost", |
| 6582 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6583 | if (err < 0) |
| 6584 | return err; |
| 6585 | } |
| 6586 | return 0; |
| 6587 | } |
| 6588 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6589 | /* almost identical with ALC880 parser... */ |
| 6590 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6591 | { |
| 6592 | struct alc_spec *spec = codec->spec; |
| 6593 | int err = alc880_parse_auto_config(codec); |
| 6594 | |
| 6595 | if (err < 0) |
| 6596 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6597 | else if (!err) |
| 6598 | return 0; /* no config found */ |
| 6599 | |
| 6600 | err = alc_auto_add_mic_boost(codec); |
| 6601 | if (err < 0) |
| 6602 | return err; |
| 6603 | |
| 6604 | /* hack - override the init verbs */ |
| 6605 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6606 | |
| 6607 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6608 | } |
| 6609 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6610 | /* additional initialization for auto-configuration model */ |
| 6611 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6612 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6613 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6614 | alc882_auto_init_multi_out(codec); |
| 6615 | alc882_auto_init_hp_out(codec); |
| 6616 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6617 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6618 | if (spec->unsol_event) |
| 6619 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6620 | } |
| 6621 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6622 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6623 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6624 | static int patch_alc882(struct hda_codec *codec) |
| 6625 | { |
| 6626 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6627 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6628 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6629 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6630 | if (spec == NULL) |
| 6631 | return -ENOMEM; |
| 6632 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6633 | codec->spec = spec; |
| 6634 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6635 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6636 | alc882_models, |
| 6637 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6638 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6639 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6640 | /* Pick up systems that don't supply PCI SSID */ |
| 6641 | switch (codec->subsystem_id) { |
| 6642 | case 0x106b0c00: /* Mac Pro */ |
| 6643 | board_config = ALC885_MACPRO; |
| 6644 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6645 | case 0x106b1000: /* iMac 24 */ |
| 6646 | board_config = ALC885_IMAC24; |
| 6647 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6648 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6649 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6650 | case 0x106b3600: /* Macbook 3.1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6651 | board_config = ALC885_MBP3; |
| 6652 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6653 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6654 | /* ALC889A is handled better as ALC888-compatible */ |
| 6655 | if (codec->revision_id == 0x100103) { |
| 6656 | alc_free(codec); |
| 6657 | return patch_alc883(codec); |
| 6658 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6659 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6660 | "trying auto-probe from BIOS...\n"); |
| 6661 | board_config = ALC882_AUTO; |
| 6662 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6663 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6664 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6665 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6666 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6667 | if (board_config == ALC882_AUTO) { |
| 6668 | /* automatic parse from the BIOS config */ |
| 6669 | err = alc882_parse_auto_config(codec); |
| 6670 | if (err < 0) { |
| 6671 | alc_free(codec); |
| 6672 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6673 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6674 | printk(KERN_INFO |
| 6675 | "hda_codec: Cannot set up configuration " |
| 6676 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6677 | board_config = ALC882_3ST_DIG; |
| 6678 | } |
| 6679 | } |
| 6680 | |
| 6681 | if (board_config != ALC882_AUTO) |
| 6682 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6683 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 6684 | if (codec->vendor_id == 0x10ec0885) { |
| 6685 | spec->stream_name_analog = "ALC885 Analog"; |
| 6686 | spec->stream_name_digital = "ALC885 Digital"; |
| 6687 | } else { |
| 6688 | spec->stream_name_analog = "ALC882 Analog"; |
| 6689 | spec->stream_name_digital = "ALC882 Digital"; |
| 6690 | } |
| 6691 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6692 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6693 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6694 | /* FIXME: setup DAC5 */ |
| 6695 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6696 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6697 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6698 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6699 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6700 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6701 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6702 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6703 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6704 | /* get type */ |
| 6705 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6706 | if (wcap != AC_WID_AUD_IN) { |
| 6707 | spec->adc_nids = alc882_adc_nids_alt; |
| 6708 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6709 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6710 | spec->mixers[spec->num_mixers] = |
| 6711 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6712 | spec->num_mixers++; |
| 6713 | } else { |
| 6714 | spec->adc_nids = alc882_adc_nids; |
| 6715 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6716 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6717 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6718 | spec->num_mixers++; |
| 6719 | } |
| 6720 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6721 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6722 | spec->vmaster_nid = 0x0c; |
| 6723 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6724 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6725 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6726 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6727 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6728 | if (!spec->loopback.amplist) |
| 6729 | spec->loopback.amplist = alc882_loopbacks; |
| 6730 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6731 | |
| 6732 | return 0; |
| 6733 | } |
| 6734 | |
| 6735 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6736 | * ALC883 support |
| 6737 | * |
| 6738 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6739 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6740 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6741 | * 6-channel independent captures. |
| 6742 | * |
| 6743 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6744 | * driver yet). |
| 6745 | */ |
| 6746 | #define ALC883_DIGOUT_NID 0x06 |
| 6747 | #define ALC883_DIGIN_NID 0x0a |
| 6748 | |
| 6749 | static hda_nid_t alc883_dac_nids[4] = { |
| 6750 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6751 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6752 | }; |
| 6753 | |
| 6754 | static hda_nid_t alc883_adc_nids[2] = { |
| 6755 | /* ADC1-2 */ |
| 6756 | 0x08, 0x09, |
| 6757 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6758 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6759 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6760 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6761 | /* input MUX */ |
| 6762 | /* FIXME: should be a matrix-type input source selection */ |
| 6763 | |
| 6764 | static struct hda_input_mux alc883_capture_source = { |
| 6765 | .num_items = 4, |
| 6766 | .items = { |
| 6767 | { "Mic", 0x0 }, |
| 6768 | { "Front Mic", 0x1 }, |
| 6769 | { "Line", 0x2 }, |
| 6770 | { "CD", 0x4 }, |
| 6771 | }, |
| 6772 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6773 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6774 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6775 | .num_items = 4, |
| 6776 | .items = { |
| 6777 | { "Mic", 0x1 }, |
| 6778 | { "Front Mic", 0x0 }, |
| 6779 | { "Line", 0x2 }, |
| 6780 | { "CD", 0x4 }, |
| 6781 | }, |
| 6782 | }; |
| 6783 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6784 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6785 | .num_items = 2, |
| 6786 | .items = { |
| 6787 | { "Mic", 0x1 }, |
| 6788 | { "Line", 0x2 }, |
| 6789 | }, |
| 6790 | }; |
| 6791 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6792 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6793 | .num_items = 4, |
| 6794 | .items = { |
| 6795 | { "Mic", 0x0 }, |
| 6796 | { "iMic", 0x1 }, |
| 6797 | { "Line", 0x2 }, |
| 6798 | { "CD", 0x4 }, |
| 6799 | }, |
| 6800 | }; |
| 6801 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6802 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6803 | .num_items = 2, |
| 6804 | .items = { |
| 6805 | { "Mic", 0x0 }, |
| 6806 | { "Int Mic", 0x1 }, |
| 6807 | }, |
| 6808 | }; |
| 6809 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6810 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6811 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6812 | /* ALC883 has the ALC882-type input selection */ |
| 6813 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6814 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6815 | /* |
| 6816 | * 2ch mode |
| 6817 | */ |
| 6818 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6819 | { 2, NULL } |
| 6820 | }; |
| 6821 | |
| 6822 | /* |
| 6823 | * 2ch mode |
| 6824 | */ |
| 6825 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6826 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6827 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6828 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6829 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6830 | { } /* end */ |
| 6831 | }; |
| 6832 | |
| 6833 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6834 | * 4ch mode |
| 6835 | */ |
| 6836 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6837 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6838 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6839 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6840 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6841 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6842 | { } /* end */ |
| 6843 | }; |
| 6844 | |
| 6845 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6846 | * 6ch mode |
| 6847 | */ |
| 6848 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6849 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6850 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6851 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6852 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6853 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6854 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6855 | { } /* end */ |
| 6856 | }; |
| 6857 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6858 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6859 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6860 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6861 | { 6, alc883_3ST_ch6_init }, |
| 6862 | }; |
| 6863 | |
| 6864 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6865 | * 2ch mode |
| 6866 | */ |
| 6867 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6868 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6869 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6870 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6871 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6872 | { } /* end */ |
| 6873 | }; |
| 6874 | |
| 6875 | /* |
| 6876 | * 4ch mode |
| 6877 | */ |
| 6878 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6879 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6880 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6881 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6882 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6883 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6884 | { } /* end */ |
| 6885 | }; |
| 6886 | |
| 6887 | /* |
| 6888 | * 6ch mode |
| 6889 | */ |
| 6890 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6891 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6892 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6893 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6894 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6895 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6896 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6897 | { } /* end */ |
| 6898 | }; |
| 6899 | |
| 6900 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6901 | { 2, alc883_3ST_ch2_intel_init }, |
| 6902 | { 4, alc883_3ST_ch4_intel_init }, |
| 6903 | { 6, alc883_3ST_ch6_intel_init }, |
| 6904 | }; |
| 6905 | |
| 6906 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6907 | * 6ch mode |
| 6908 | */ |
| 6909 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6910 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6911 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6912 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6913 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6914 | { } /* end */ |
| 6915 | }; |
| 6916 | |
| 6917 | /* |
| 6918 | * 8ch mode |
| 6919 | */ |
| 6920 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6921 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6922 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6923 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6924 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6925 | { } /* end */ |
| 6926 | }; |
| 6927 | |
| 6928 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6929 | { 6, alc883_sixstack_ch6_init }, |
| 6930 | { 8, alc883_sixstack_ch8_init }, |
| 6931 | }; |
| 6932 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6933 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6934 | /* eanable EAPD on medion laptop */ |
| 6935 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6936 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6937 | { } |
| 6938 | }; |
| 6939 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6940 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6941 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6942 | */ |
| 6943 | |
| 6944 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6945 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6946 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6947 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6948 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6949 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6950 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6951 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6952 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6953 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6954 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6955 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6956 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6957 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6958 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6959 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6960 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6961 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6962 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6963 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6964 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6965 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6966 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6967 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6968 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6969 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6970 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6971 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6972 | { |
| 6973 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6974 | /* .name = "Capture Source", */ |
| 6975 | .name = "Input Source", |
| 6976 | .count = 2, |
| 6977 | .info = alc883_mux_enum_info, |
| 6978 | .get = alc883_mux_enum_get, |
| 6979 | .put = alc883_mux_enum_put, |
| 6980 | }, |
| 6981 | { } /* end */ |
| 6982 | }; |
| 6983 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6984 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6985 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6986 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6987 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6988 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6989 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6990 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6991 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6992 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6993 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6995 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6996 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6997 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, 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 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7014 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7015 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7016 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7017 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7018 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7019 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7020 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7022 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7023 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7024 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7025 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7026 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7027 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7028 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7029 | { |
| 7030 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7031 | /* .name = "Capture Source", */ |
| 7032 | .name = "Input Source", |
| 7033 | .count = 2, |
| 7034 | .info = alc883_mux_enum_info, |
| 7035 | .get = alc883_mux_enum_get, |
| 7036 | .put = alc883_mux_enum_put, |
| 7037 | }, |
| 7038 | { } /* end */ |
| 7039 | }; |
| 7040 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7041 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7042 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7043 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7044 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7045 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7046 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7047 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7048 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7049 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7050 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7051 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7052 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7053 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7054 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7055 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7056 | { |
| 7057 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7058 | /* .name = "Capture Source", */ |
| 7059 | .name = "Input Source", |
| 7060 | .count = 2, |
| 7061 | .info = alc883_mux_enum_info, |
| 7062 | .get = alc883_mux_enum_get, |
| 7063 | .put = alc883_mux_enum_put, |
| 7064 | }, |
| 7065 | { } /* end */ |
| 7066 | }; |
| 7067 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7068 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7069 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7070 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7071 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7072 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7073 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7074 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7075 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7076 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7077 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7078 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7079 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7080 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7081 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7082 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7083 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7084 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7085 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7086 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7087 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7088 | { |
| 7089 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7090 | /* .name = "Capture Source", */ |
| 7091 | .name = "Input Source", |
| 7092 | .count = 2, |
| 7093 | .info = alc883_mux_enum_info, |
| 7094 | .get = alc883_mux_enum_get, |
| 7095 | .put = alc883_mux_enum_put, |
| 7096 | }, |
| 7097 | { } /* end */ |
| 7098 | }; |
| 7099 | |
| 7100 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7101 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7102 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7103 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7104 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7105 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7106 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7107 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7108 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7109 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7110 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7111 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7112 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7113 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7114 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7115 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7116 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7117 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7118 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7119 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7120 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7121 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7122 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7123 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7124 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7125 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7126 | { |
| 7127 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7128 | /* .name = "Capture Source", */ |
| 7129 | .name = "Input Source", |
| 7130 | .count = 2, |
| 7131 | .info = alc883_mux_enum_info, |
| 7132 | .get = alc883_mux_enum_get, |
| 7133 | .put = alc883_mux_enum_put, |
| 7134 | }, |
| 7135 | { } /* end */ |
| 7136 | }; |
| 7137 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7138 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7139 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7140 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7141 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7142 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7143 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7144 | HDA_OUTPUT), |
| 7145 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7146 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7147 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7148 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7149 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7150 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7151 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7152 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7153 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7154 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7155 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7156 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7157 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7158 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7159 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7160 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7161 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7162 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7163 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7164 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7165 | { |
| 7166 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7167 | /* .name = "Capture Source", */ |
| 7168 | .name = "Input Source", |
| 7169 | .count = 2, |
| 7170 | .info = alc883_mux_enum_info, |
| 7171 | .get = alc883_mux_enum_get, |
| 7172 | .put = alc883_mux_enum_put, |
| 7173 | }, |
| 7174 | { } /* end */ |
| 7175 | }; |
| 7176 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7177 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7178 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7179 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7180 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7181 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7182 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7183 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7184 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7185 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7186 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7187 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7188 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7189 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7190 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7191 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7192 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7194 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7195 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7196 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7197 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7198 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7199 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7200 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7201 | |
| 7202 | { |
| 7203 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7204 | /* .name = "Capture Source", */ |
| 7205 | .name = "Input Source", |
| 7206 | .count = 1, |
| 7207 | .info = alc883_mux_enum_info, |
| 7208 | .get = alc883_mux_enum_get, |
| 7209 | .put = alc883_mux_enum_put, |
| 7210 | }, |
| 7211 | { } /* end */ |
| 7212 | }; |
| 7213 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7214 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7215 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7216 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7217 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7218 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7219 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7220 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7221 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7222 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7223 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7224 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7225 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7226 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7227 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7228 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7229 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7230 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7231 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7232 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7233 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7234 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7235 | { |
| 7236 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7237 | /* .name = "Capture Source", */ |
| 7238 | .name = "Input Source", |
| 7239 | .count = 2, |
| 7240 | .info = alc883_mux_enum_info, |
| 7241 | .get = alc883_mux_enum_get, |
| 7242 | .put = alc883_mux_enum_put, |
| 7243 | }, |
| 7244 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7245 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7246 | |
| 7247 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7248 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7249 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7250 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7251 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7252 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7254 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7255 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7256 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7257 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7258 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7259 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7260 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7261 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7262 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7263 | { |
| 7264 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7265 | /* .name = "Capture Source", */ |
| 7266 | .name = "Input Source", |
| 7267 | .count = 2, |
| 7268 | .info = alc883_mux_enum_info, |
| 7269 | .get = alc883_mux_enum_get, |
| 7270 | .put = alc883_mux_enum_put, |
| 7271 | }, |
| 7272 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7273 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7274 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7275 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7276 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7277 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7278 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7279 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7280 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7281 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7282 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7283 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7284 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7285 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7286 | { |
| 7287 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7288 | /* .name = "Capture Source", */ |
| 7289 | .name = "Input Source", |
| 7290 | .count = 1, |
| 7291 | .info = alc883_mux_enum_info, |
| 7292 | .get = alc883_mux_enum_get, |
| 7293 | .put = alc883_mux_enum_put, |
| 7294 | }, |
| 7295 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7296 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7297 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7298 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7299 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7300 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7301 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7302 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7303 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7304 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7305 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7306 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7307 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7308 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7309 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7310 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7311 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7312 | { |
| 7313 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7314 | /* .name = "Capture Source", */ |
| 7315 | .name = "Input Source", |
| 7316 | .count = 2, |
| 7317 | .info = alc883_mux_enum_info, |
| 7318 | .get = alc883_mux_enum_get, |
| 7319 | .put = alc883_mux_enum_put, |
| 7320 | }, |
| 7321 | { } /* end */ |
| 7322 | }; |
| 7323 | |
| 7324 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7325 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7326 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7327 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7328 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7329 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7330 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7331 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7332 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7333 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7334 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7335 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7336 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7337 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7338 | { |
| 7339 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7340 | /* .name = "Capture Source", */ |
| 7341 | .name = "Input Source", |
| 7342 | .count = 2, |
| 7343 | .info = alc883_mux_enum_info, |
| 7344 | .get = alc883_mux_enum_get, |
| 7345 | .put = alc883_mux_enum_put, |
| 7346 | }, |
| 7347 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7348 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7349 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7350 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7351 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7352 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7353 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7354 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7355 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7356 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7357 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7358 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7359 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7360 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7361 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7362 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7363 | { |
| 7364 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7365 | /* .name = "Capture Source", */ |
| 7366 | .name = "Input Source", |
| 7367 | .count = 2, |
| 7368 | .info = alc883_mux_enum_info, |
| 7369 | .get = alc883_mux_enum_get, |
| 7370 | .put = alc883_mux_enum_put, |
| 7371 | }, |
| 7372 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7373 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7374 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7375 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7376 | { |
| 7377 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7378 | .name = "Channel Mode", |
| 7379 | .info = alc_ch_mode_info, |
| 7380 | .get = alc_ch_mode_get, |
| 7381 | .put = alc_ch_mode_put, |
| 7382 | }, |
| 7383 | { } /* end */ |
| 7384 | }; |
| 7385 | |
| 7386 | static struct hda_verb alc883_init_verbs[] = { |
| 7387 | /* ADC1: mute amp left and right */ |
| 7388 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7389 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7390 | /* ADC2: mute amp left and right */ |
| 7391 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7392 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7393 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7394 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7395 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7396 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7397 | /* Rear mixer */ |
| 7398 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7399 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7400 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7401 | /* CLFE mixer */ |
| 7402 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7403 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7404 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7405 | /* Side mixer */ |
| 7406 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7407 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7408 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7409 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7410 | /* mute analog input loopbacks */ |
| 7411 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7412 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7413 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7414 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7415 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7416 | |
| 7417 | /* Front Pin: output 0 (0x0c) */ |
| 7418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7419 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7420 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7421 | /* Rear Pin: output 1 (0x0d) */ |
| 7422 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7424 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7425 | /* CLFE Pin: output 2 (0x0e) */ |
| 7426 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7427 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7428 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7429 | /* Side Pin: output 3 (0x0f) */ |
| 7430 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7431 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7432 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7433 | /* Mic (rear) pin: input vref at 80% */ |
| 7434 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7435 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7436 | /* Front Mic pin: input vref at 80% */ |
| 7437 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7438 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7439 | /* Line In pin: input */ |
| 7440 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7441 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7442 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7443 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7444 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7445 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7446 | /* CD pin widget for input */ |
| 7447 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7448 | |
| 7449 | /* FIXME: use matrix-type input source selection */ |
| 7450 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7451 | /* Input mixer2 */ |
| 7452 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7453 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7454 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7455 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7456 | /* Input mixer3 */ |
| 7457 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7459 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7460 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7461 | { } |
| 7462 | }; |
| 7463 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7464 | /* toggle speaker-output according to the hp-jack state */ |
| 7465 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7466 | { |
| 7467 | unsigned int present; |
| 7468 | |
| 7469 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7470 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7471 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7472 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7473 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7474 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7475 | } |
| 7476 | |
| 7477 | /* auto-toggle front mic */ |
| 7478 | /* |
| 7479 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7480 | { |
| 7481 | unsigned int present; |
| 7482 | unsigned char bits; |
| 7483 | |
| 7484 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7485 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7486 | bits = present ? HDA_AMP_MUTE : 0; |
| 7487 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7488 | } |
| 7489 | */ |
| 7490 | |
| 7491 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7492 | { |
| 7493 | alc883_mitac_hp_automute(codec); |
| 7494 | /* alc883_mitac_mic_automute(codec); */ |
| 7495 | } |
| 7496 | |
| 7497 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7498 | unsigned int res) |
| 7499 | { |
| 7500 | switch (res >> 26) { |
| 7501 | case ALC880_HP_EVENT: |
| 7502 | alc883_mitac_hp_automute(codec); |
| 7503 | break; |
| 7504 | case ALC880_MIC_EVENT: |
| 7505 | /* alc883_mitac_mic_automute(codec); */ |
| 7506 | break; |
| 7507 | } |
| 7508 | } |
| 7509 | |
| 7510 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7511 | /* HP */ |
| 7512 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7513 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7514 | /* Subwoofer */ |
| 7515 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7516 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7517 | |
| 7518 | /* enable unsolicited event */ |
| 7519 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7520 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7521 | |
| 7522 | { } /* end */ |
| 7523 | }; |
| 7524 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7525 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7526 | /* HP */ |
| 7527 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7528 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7529 | /* Int speaker */ |
| 7530 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7531 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7532 | |
| 7533 | /* enable unsolicited event */ |
| 7534 | {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] | 7535 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7536 | |
| 7537 | { } /* end */ |
| 7538 | }; |
| 7539 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7540 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7541 | /* HP */ |
| 7542 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7543 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7544 | /* Subwoofer */ |
| 7545 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7546 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7547 | |
| 7548 | /* enable unsolicited event */ |
| 7549 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7550 | |
| 7551 | { } /* end */ |
| 7552 | }; |
| 7553 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7554 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7555 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7556 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7557 | |
| 7558 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7559 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7560 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7561 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7562 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7563 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7564 | |
| 7565 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7566 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7567 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7568 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7569 | |
| 7570 | { } /* end */ |
| 7571 | }; |
| 7572 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7573 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7574 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7575 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7576 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7577 | { } /* end */ |
| 7578 | }; |
| 7579 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7580 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7581 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7582 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7583 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7584 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7585 | { } /* end */ |
| 7586 | }; |
| 7587 | |
| 7588 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7589 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7591 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7592 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7593 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7594 | { } /* end */ |
| 7595 | }; |
| 7596 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7597 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7599 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7600 | |
| 7601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7602 | |
| 7603 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7604 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7605 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7606 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7607 | { } /* end */ |
| 7608 | }; |
| 7609 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7610 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7611 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7612 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7613 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7614 | { } |
| 7615 | }; |
| 7616 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7617 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7618 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7619 | { } |
| 7620 | }; |
| 7621 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7622 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7623 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7624 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7625 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7626 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7627 | { } |
| 7628 | }; |
| 7629 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7630 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7631 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7632 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7633 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7634 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7635 | { } |
| 7636 | }; |
| 7637 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7638 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7639 | { 2, alc888_3st_hp_2ch_init }, |
| 7640 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7641 | }; |
| 7642 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7643 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7644 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7645 | { |
| 7646 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7647 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7648 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7649 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7650 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7651 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7652 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7653 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7654 | } |
| 7655 | |
| 7656 | /* toggle RCA according to the front-jack state */ |
| 7657 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7658 | { |
| 7659 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7660 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7661 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7662 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7663 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7664 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7665 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7666 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7667 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7668 | unsigned int res) |
| 7669 | { |
| 7670 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7671 | alc888_lenovo_ms7195_front_automute(codec); |
| 7672 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7673 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7674 | } |
| 7675 | |
| 7676 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7677 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7678 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7679 | |
| 7680 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7681 | |
| 7682 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7683 | { } /* end */ |
| 7684 | }; |
| 7685 | |
| 7686 | /* toggle speaker-output according to the hp-jack state */ |
| 7687 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7688 | { |
| 7689 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7690 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7691 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7692 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7693 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7694 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7695 | } |
| 7696 | |
| 7697 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7698 | unsigned int res) |
| 7699 | { |
| 7700 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7701 | alc883_medion_md2_automute(codec); |
| 7702 | } |
| 7703 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7704 | /* toggle speaker-output according to the hp-jack state */ |
| 7705 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7706 | { |
| 7707 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7708 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7709 | |
| 7710 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7711 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7712 | bits = present ? HDA_AMP_MUTE : 0; |
| 7713 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7714 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7715 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7716 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7717 | } |
| 7718 | |
| 7719 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7720 | { |
| 7721 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7722 | alc883_tagra_automute(codec); |
| 7723 | } |
| 7724 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7725 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7726 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7727 | { |
| 7728 | unsigned int present; |
| 7729 | unsigned char bits; |
| 7730 | |
| 7731 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7732 | & AC_PINSENSE_PRESENCE; |
| 7733 | bits = present ? HDA_AMP_MUTE : 0; |
| 7734 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7735 | HDA_AMP_MUTE, bits); |
| 7736 | } |
| 7737 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7738 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7739 | { |
| 7740 | unsigned int present; |
| 7741 | |
| 7742 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7743 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7744 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7745 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7746 | } |
| 7747 | |
| 7748 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7749 | { |
| 7750 | alc883_clevo_m720_hp_automute(codec); |
| 7751 | alc883_clevo_m720_mic_automute(codec); |
| 7752 | } |
| 7753 | |
| 7754 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7755 | unsigned int res) |
| 7756 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7757 | switch (res >> 26) { |
| 7758 | case ALC880_HP_EVENT: |
| 7759 | alc883_clevo_m720_hp_automute(codec); |
| 7760 | break; |
| 7761 | case ALC880_MIC_EVENT: |
| 7762 | alc883_clevo_m720_mic_automute(codec); |
| 7763 | break; |
| 7764 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7765 | } |
| 7766 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7767 | /* toggle speaker-output according to the hp-jack state */ |
| 7768 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7769 | { |
| 7770 | unsigned int present; |
| 7771 | unsigned char bits; |
| 7772 | |
| 7773 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7774 | & AC_PINSENSE_PRESENCE; |
| 7775 | bits = present ? HDA_AMP_MUTE : 0; |
| 7776 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7777 | HDA_AMP_MUTE, bits); |
| 7778 | } |
| 7779 | |
| 7780 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7781 | unsigned int res) |
| 7782 | { |
| 7783 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7784 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7785 | } |
| 7786 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7787 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7788 | { |
| 7789 | unsigned int present; |
| 7790 | unsigned char bits; |
| 7791 | |
| 7792 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7793 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7794 | bits = present ? 0x80 : 0; |
| 7795 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7796 | 0x80, bits); |
| 7797 | } |
| 7798 | |
| 7799 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7800 | unsigned int res) |
| 7801 | { |
| 7802 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7803 | alc883_haier_w66_automute(codec); |
| 7804 | } |
| 7805 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7806 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7807 | { |
| 7808 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7809 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7810 | |
| 7811 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7812 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7813 | bits = present ? HDA_AMP_MUTE : 0; |
| 7814 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7815 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7816 | } |
| 7817 | |
| 7818 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7819 | { |
| 7820 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7821 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7822 | |
| 7823 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7824 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7825 | bits = present ? HDA_AMP_MUTE : 0; |
| 7826 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7827 | HDA_AMP_MUTE, bits); |
| 7828 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7829 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7830 | } |
| 7831 | |
| 7832 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7833 | unsigned int res) |
| 7834 | { |
| 7835 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7836 | alc883_lenovo_101e_all_automute(codec); |
| 7837 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7838 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7839 | } |
| 7840 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7841 | /* toggle speaker-output according to the hp-jack state */ |
| 7842 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7843 | { |
| 7844 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7845 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7846 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7847 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7848 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7849 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7850 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7851 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7852 | } |
| 7853 | |
| 7854 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7855 | unsigned int res) |
| 7856 | { |
| 7857 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7858 | alc883_acer_aspire_automute(codec); |
| 7859 | } |
| 7860 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7861 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7862 | /* HP Pin: output 0 (0x0c) */ |
| 7863 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7864 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7865 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7866 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7867 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7868 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7869 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7870 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7871 | /* eanable EAPD on medion laptop */ |
| 7872 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7873 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7874 | /* enable unsolicited event */ |
| 7875 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7876 | { } |
| 7877 | }; |
| 7878 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7879 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7880 | { |
| 7881 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7882 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7883 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7884 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7885 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7886 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7887 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7888 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7889 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7890 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7891 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7892 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7893 | } |
| 7894 | |
| 7895 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7896 | unsigned int res) |
| 7897 | { |
| 7898 | switch (res >> 26) { |
| 7899 | case ALC880_HP_EVENT: |
| 7900 | printk("hp_event\n"); |
| 7901 | alc888_6st_dell_front_automute(codec); |
| 7902 | break; |
| 7903 | } |
| 7904 | } |
| 7905 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7906 | /* |
| 7907 | * generic initialization of ADC, input mixers and output mixers |
| 7908 | */ |
| 7909 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7910 | /* |
| 7911 | * Unmute ADC0-2 and set the default input to mic-in |
| 7912 | */ |
| 7913 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7914 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7915 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7916 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7917 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7918 | /* 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] | 7919 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7920 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7921 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7922 | */ |
| 7923 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7924 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7925 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7928 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7929 | |
| 7930 | /* |
| 7931 | * Set up output mixers (0x0c - 0x0f) |
| 7932 | */ |
| 7933 | /* set vol=0 to output mixers */ |
| 7934 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7935 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7936 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7937 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7938 | /* set up input amps for analog loopback */ |
| 7939 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7940 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7941 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7942 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7943 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7944 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7945 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7946 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7947 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7948 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7949 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7950 | |
| 7951 | /* FIXME: use matrix-type input source selection */ |
| 7952 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7953 | /* Input mixer1 */ |
| 7954 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7955 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7956 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7957 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7958 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7959 | /* Input mixer2 */ |
| 7960 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7961 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7962 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7963 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7964 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7965 | |
| 7966 | { } |
| 7967 | }; |
| 7968 | |
| 7969 | /* capture mixer elements */ |
| 7970 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7971 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7972 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7973 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7974 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7975 | { |
| 7976 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7977 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7978 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7979 | */ |
| 7980 | /* .name = "Capture Source", */ |
| 7981 | .name = "Input Source", |
| 7982 | .count = 2, |
| 7983 | .info = alc882_mux_enum_info, |
| 7984 | .get = alc882_mux_enum_get, |
| 7985 | .put = alc882_mux_enum_put, |
| 7986 | }, |
| 7987 | { } /* end */ |
| 7988 | }; |
| 7989 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7990 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7991 | #define alc883_loopbacks alc880_loopbacks |
| 7992 | #endif |
| 7993 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7994 | /* pcm configuration: identiacal with ALC880 */ |
| 7995 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7996 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7997 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7998 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7999 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8000 | |
| 8001 | /* |
| 8002 | * configuration and preset |
| 8003 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8004 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8005 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8006 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8007 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8008 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8009 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8010 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8011 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8012 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8013 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8014 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8015 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8016 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8017 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8018 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8019 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8020 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8021 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8022 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8023 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8024 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8025 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8026 | [ALC883_AUTO] = "auto", |
| 8027 | }; |
| 8028 | |
| 8029 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8030 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8031 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 8032 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8033 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8034 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8035 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8036 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8037 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8038 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8039 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8040 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8041 | 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] | 8042 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8043 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8044 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8045 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 8046 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8047 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8048 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8049 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8050 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8051 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8052 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8053 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8054 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8055 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8056 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8057 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8058 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8059 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8060 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8061 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8062 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8063 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8064 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8065 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8066 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8067 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8068 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8069 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8070 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8071 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8072 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8073 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8074 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8075 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8076 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8077 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8078 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8079 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8080 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8081 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8082 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8083 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8084 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8085 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8086 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8087 | {} |
| 8088 | }; |
| 8089 | |
| 8090 | static struct alc_config_preset alc883_presets[] = { |
| 8091 | [ALC883_3ST_2ch_DIG] = { |
| 8092 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8093 | .init_verbs = { alc883_init_verbs }, |
| 8094 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8095 | .dac_nids = alc883_dac_nids, |
| 8096 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8097 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8098 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8099 | .channel_mode = alc883_3ST_2ch_modes, |
| 8100 | .input_mux = &alc883_capture_source, |
| 8101 | }, |
| 8102 | [ALC883_3ST_6ch_DIG] = { |
| 8103 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8104 | .init_verbs = { alc883_init_verbs }, |
| 8105 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8106 | .dac_nids = alc883_dac_nids, |
| 8107 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8108 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8109 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8110 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8111 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8112 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8113 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8114 | [ALC883_3ST_6ch] = { |
| 8115 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8116 | .init_verbs = { alc883_init_verbs }, |
| 8117 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8118 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8119 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8120 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8121 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8122 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8123 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8124 | [ALC883_3ST_6ch_INTEL] = { |
| 8125 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8126 | .init_verbs = { alc883_init_verbs }, |
| 8127 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8128 | .dac_nids = alc883_dac_nids, |
| 8129 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8130 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8131 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8132 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8133 | .need_dac_fix = 1, |
| 8134 | .input_mux = &alc883_3stack_6ch_intel, |
| 8135 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8136 | [ALC883_6ST_DIG] = { |
| 8137 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8138 | .init_verbs = { alc883_init_verbs }, |
| 8139 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8140 | .dac_nids = alc883_dac_nids, |
| 8141 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8142 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8143 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8144 | .channel_mode = alc883_sixstack_modes, |
| 8145 | .input_mux = &alc883_capture_source, |
| 8146 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8147 | [ALC883_TARGA_DIG] = { |
| 8148 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8149 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8150 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8151 | .dac_nids = alc883_dac_nids, |
| 8152 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8153 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8154 | .channel_mode = alc883_3ST_6ch_modes, |
| 8155 | .need_dac_fix = 1, |
| 8156 | .input_mux = &alc883_capture_source, |
| 8157 | .unsol_event = alc883_tagra_unsol_event, |
| 8158 | .init_hook = alc883_tagra_automute, |
| 8159 | }, |
| 8160 | [ALC883_TARGA_2ch_DIG] = { |
| 8161 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8162 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8163 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8164 | .dac_nids = alc883_dac_nids, |
| 8165 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8166 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8167 | .channel_mode = alc883_3ST_2ch_modes, |
| 8168 | .input_mux = &alc883_capture_source, |
| 8169 | .unsol_event = alc883_tagra_unsol_event, |
| 8170 | .init_hook = alc883_tagra_automute, |
| 8171 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8172 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8173 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8174 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8175 | * and the headphone jack. Turn this on and rely on the |
| 8176 | * standard mute methods whenever the user wants to turn |
| 8177 | * these outputs off. |
| 8178 | */ |
| 8179 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8180 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8181 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8182 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8183 | .channel_mode = alc883_3ST_2ch_modes, |
| 8184 | .input_mux = &alc883_capture_source, |
| 8185 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8186 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8187 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8188 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8189 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8190 | .dac_nids = alc883_dac_nids, |
| 8191 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8192 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8193 | .channel_mode = alc883_3ST_2ch_modes, |
| 8194 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8195 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8196 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8197 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8198 | [ALC883_MEDION] = { |
| 8199 | .mixers = { alc883_fivestack_mixer, |
| 8200 | alc883_chmode_mixer }, |
| 8201 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8202 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8203 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8204 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8205 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8206 | .channel_mode = alc883_sixstack_modes, |
| 8207 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8208 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8209 | [ALC883_MEDION_MD2] = { |
| 8210 | .mixers = { alc883_medion_md2_mixer}, |
| 8211 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8212 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8213 | .dac_nids = alc883_dac_nids, |
| 8214 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8215 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8216 | .channel_mode = alc883_3ST_2ch_modes, |
| 8217 | .input_mux = &alc883_capture_source, |
| 8218 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8219 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8220 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8221 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8222 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8223 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8224 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8225 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8226 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8227 | .channel_mode = alc883_3ST_2ch_modes, |
| 8228 | .input_mux = &alc883_capture_source, |
| 8229 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8230 | [ALC883_CLEVO_M720] = { |
| 8231 | .mixers = { alc883_clevo_m720_mixer }, |
| 8232 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8233 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8234 | .dac_nids = alc883_dac_nids, |
| 8235 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8236 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8237 | .channel_mode = alc883_3ST_2ch_modes, |
| 8238 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8239 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8240 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8241 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8242 | [ALC883_LENOVO_101E_2ch] = { |
| 8243 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8244 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8245 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8246 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8247 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8248 | .channel_mode = alc883_3ST_2ch_modes, |
| 8249 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8250 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8251 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8252 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8253 | [ALC883_LENOVO_NB0763] = { |
| 8254 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8255 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8256 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8257 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8258 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8259 | .channel_mode = alc883_3ST_2ch_modes, |
| 8260 | .need_dac_fix = 1, |
| 8261 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8262 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8263 | .init_hook = alc883_medion_md2_automute, |
| 8264 | }, |
| 8265 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8266 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8267 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8268 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8269 | .dac_nids = alc883_dac_nids, |
| 8270 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8271 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8272 | .channel_mode = alc883_3ST_6ch_modes, |
| 8273 | .need_dac_fix = 1, |
| 8274 | .input_mux = &alc883_capture_source, |
| 8275 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8276 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8277 | }, |
| 8278 | [ALC883_HAIER_W66] = { |
| 8279 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8280 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8281 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8282 | .dac_nids = alc883_dac_nids, |
| 8283 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8284 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8285 | .channel_mode = alc883_3ST_2ch_modes, |
| 8286 | .input_mux = &alc883_capture_source, |
| 8287 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8288 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8289 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8290 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8291 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8292 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8293 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8294 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8295 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8296 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8297 | .need_dac_fix = 1, |
| 8298 | .input_mux = &alc883_capture_source, |
| 8299 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8300 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8301 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8302 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8303 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8304 | .dac_nids = alc883_dac_nids, |
| 8305 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8306 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8307 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8308 | .channel_mode = alc883_sixstack_modes, |
| 8309 | .input_mux = &alc883_capture_source, |
| 8310 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8311 | .init_hook = alc888_6st_dell_front_automute, |
| 8312 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8313 | [ALC883_MITAC] = { |
| 8314 | .mixers = { alc883_mitac_mixer }, |
| 8315 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8316 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8317 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8318 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8319 | .channel_mode = alc883_3ST_2ch_modes, |
| 8320 | .input_mux = &alc883_capture_source, |
| 8321 | .unsol_event = alc883_mitac_unsol_event, |
| 8322 | .init_hook = alc883_mitac_automute, |
| 8323 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8324 | [ALC883_FUJITSU_PI2515] = { |
| 8325 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8326 | .init_verbs = { alc883_init_verbs, |
| 8327 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8328 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8329 | .dac_nids = alc883_dac_nids, |
| 8330 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8331 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8332 | .channel_mode = alc883_3ST_2ch_modes, |
| 8333 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8334 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8335 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8336 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8337 | }; |
| 8338 | |
| 8339 | |
| 8340 | /* |
| 8341 | * BIOS auto configuration |
| 8342 | */ |
| 8343 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8344 | hda_nid_t nid, int pin_type, |
| 8345 | int dac_idx) |
| 8346 | { |
| 8347 | /* set as output */ |
| 8348 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8349 | int idx; |
| 8350 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8351 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8352 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8353 | idx = 4; |
| 8354 | else |
| 8355 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8356 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8357 | |
| 8358 | } |
| 8359 | |
| 8360 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8361 | { |
| 8362 | struct alc_spec *spec = codec->spec; |
| 8363 | int i; |
| 8364 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8365 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8366 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8367 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8368 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8369 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8370 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8371 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8372 | } |
| 8373 | } |
| 8374 | |
| 8375 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8376 | { |
| 8377 | struct alc_spec *spec = codec->spec; |
| 8378 | hda_nid_t pin; |
| 8379 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8380 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8381 | if (pin) /* connect to front */ |
| 8382 | /* use dac 0 */ |
| 8383 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8384 | pin = spec->autocfg.speaker_pins[0]; |
| 8385 | if (pin) |
| 8386 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8387 | } |
| 8388 | |
| 8389 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8390 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8391 | |
| 8392 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8393 | { |
| 8394 | struct alc_spec *spec = codec->spec; |
| 8395 | int i; |
| 8396 | |
| 8397 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8398 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8399 | if (alc883_is_input_pin(nid)) { |
| 8400 | snd_hda_codec_write(codec, nid, 0, |
| 8401 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8402 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8403 | PIN_VREF80 : PIN_IN)); |
| 8404 | if (nid != ALC883_PIN_CD_NID) |
| 8405 | snd_hda_codec_write(codec, nid, 0, |
| 8406 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8407 | AMP_OUT_MUTE); |
| 8408 | } |
| 8409 | } |
| 8410 | } |
| 8411 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8412 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 8413 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8414 | /* almost identical with ALC880 parser... */ |
| 8415 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8416 | { |
| 8417 | struct alc_spec *spec = codec->spec; |
| 8418 | int err = alc880_parse_auto_config(codec); |
| 8419 | |
| 8420 | if (err < 0) |
| 8421 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8422 | else if (!err) |
| 8423 | return 0; /* no config found */ |
| 8424 | |
| 8425 | err = alc_auto_add_mic_boost(codec); |
| 8426 | if (err < 0) |
| 8427 | return err; |
| 8428 | |
| 8429 | /* hack - override the init verbs */ |
| 8430 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8431 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8432 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8433 | |
| 8434 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8435 | } |
| 8436 | |
| 8437 | /* additional initialization for auto-configuration model */ |
| 8438 | static void alc883_auto_init(struct hda_codec *codec) |
| 8439 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8440 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8441 | alc883_auto_init_multi_out(codec); |
| 8442 | alc883_auto_init_hp_out(codec); |
| 8443 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8444 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8445 | if (spec->unsol_event) |
| 8446 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8447 | } |
| 8448 | |
| 8449 | static int patch_alc883(struct hda_codec *codec) |
| 8450 | { |
| 8451 | struct alc_spec *spec; |
| 8452 | int err, board_config; |
| 8453 | |
| 8454 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8455 | if (spec == NULL) |
| 8456 | return -ENOMEM; |
| 8457 | |
| 8458 | codec->spec = spec; |
| 8459 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 8460 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 8461 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8462 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8463 | alc883_models, |
| 8464 | alc883_cfg_tbl); |
| 8465 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8466 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8467 | "trying auto-probe from BIOS...\n"); |
| 8468 | board_config = ALC883_AUTO; |
| 8469 | } |
| 8470 | |
| 8471 | if (board_config == ALC883_AUTO) { |
| 8472 | /* automatic parse from the BIOS config */ |
| 8473 | err = alc883_parse_auto_config(codec); |
| 8474 | if (err < 0) { |
| 8475 | alc_free(codec); |
| 8476 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8477 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8478 | printk(KERN_INFO |
| 8479 | "hda_codec: Cannot set up configuration " |
| 8480 | "from BIOS. Using base mode...\n"); |
| 8481 | board_config = ALC883_3ST_2ch_DIG; |
| 8482 | } |
| 8483 | } |
| 8484 | |
| 8485 | if (board_config != ALC883_AUTO) |
| 8486 | setup_preset(spec, &alc883_presets[board_config]); |
| 8487 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8488 | switch (codec->vendor_id) { |
| 8489 | case 0x10ec0888: |
| 8490 | spec->stream_name_analog = "ALC888 Analog"; |
| 8491 | spec->stream_name_digital = "ALC888 Digital"; |
| 8492 | break; |
| 8493 | case 0x10ec0889: |
| 8494 | spec->stream_name_analog = "ALC889 Analog"; |
| 8495 | spec->stream_name_digital = "ALC889 Digital"; |
| 8496 | break; |
| 8497 | default: |
| 8498 | spec->stream_name_analog = "ALC883 Analog"; |
| 8499 | spec->stream_name_digital = "ALC883 Digital"; |
| 8500 | break; |
| 8501 | } |
| 8502 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8503 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8504 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8505 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8506 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8507 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8508 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8509 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8510 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8511 | spec->adc_nids = alc883_adc_nids; |
| 8512 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8513 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8514 | spec->vmaster_nid = 0x0c; |
| 8515 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8516 | codec->patch_ops = alc_patch_ops; |
| 8517 | if (board_config == ALC883_AUTO) |
| 8518 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 8519 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8520 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8521 | if (!spec->loopback.amplist) |
| 8522 | spec->loopback.amplist = alc883_loopbacks; |
| 8523 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8524 | |
| 8525 | return 0; |
| 8526 | } |
| 8527 | |
| 8528 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8529 | * ALC262 support |
| 8530 | */ |
| 8531 | |
| 8532 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8533 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8534 | |
| 8535 | #define alc262_dac_nids alc260_dac_nids |
| 8536 | #define alc262_adc_nids alc882_adc_nids |
| 8537 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8538 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8539 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8540 | |
| 8541 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8542 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8543 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 8544 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 8545 | /* ADC0 */ |
| 8546 | 0x09 |
| 8547 | }; |
| 8548 | |
| 8549 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 8550 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8551 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8552 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8553 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8554 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8555 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8556 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8557 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8558 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8559 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8560 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8561 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8562 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8563 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8564 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8565 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8566 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8567 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8568 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8569 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8570 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8571 | }; |
| 8572 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8573 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8574 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8575 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8576 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8577 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8578 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8579 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8580 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8581 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8582 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8583 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8584 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8585 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8586 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8587 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8588 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8589 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8590 | { } /* end */ |
| 8591 | }; |
| 8592 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8593 | /* update HP, line and mono-out pins according to the master switch */ |
| 8594 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8595 | { |
| 8596 | struct alc_spec *spec = codec->spec; |
| 8597 | int val = spec->master_sw; |
| 8598 | |
| 8599 | /* HP & line-out */ |
| 8600 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8601 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8602 | val ? PIN_HP : 0); |
| 8603 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8604 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8605 | val ? PIN_HP : 0); |
| 8606 | /* mono (speaker) depending on the HP jack sense */ |
| 8607 | val = val && !spec->jack_present; |
| 8608 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8609 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8610 | val ? PIN_OUT : 0); |
| 8611 | } |
| 8612 | |
| 8613 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8614 | { |
| 8615 | struct alc_spec *spec = codec->spec; |
| 8616 | unsigned int presence; |
| 8617 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8618 | AC_VERB_GET_PIN_SENSE, 0); |
| 8619 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8620 | alc262_hp_master_update(codec); |
| 8621 | } |
| 8622 | |
| 8623 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8624 | { |
| 8625 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8626 | return; |
| 8627 | alc262_hp_bpc_automute(codec); |
| 8628 | } |
| 8629 | |
| 8630 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8631 | { |
| 8632 | struct alc_spec *spec = codec->spec; |
| 8633 | unsigned int presence; |
| 8634 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8635 | AC_VERB_GET_PIN_SENSE, 0); |
| 8636 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8637 | alc262_hp_master_update(codec); |
| 8638 | } |
| 8639 | |
| 8640 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8641 | unsigned int res) |
| 8642 | { |
| 8643 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8644 | return; |
| 8645 | alc262_hp_wildwest_automute(codec); |
| 8646 | } |
| 8647 | |
| 8648 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8649 | struct snd_ctl_elem_value *ucontrol) |
| 8650 | { |
| 8651 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8652 | struct alc_spec *spec = codec->spec; |
| 8653 | *ucontrol->value.integer.value = spec->master_sw; |
| 8654 | return 0; |
| 8655 | } |
| 8656 | |
| 8657 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8658 | struct snd_ctl_elem_value *ucontrol) |
| 8659 | { |
| 8660 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8661 | struct alc_spec *spec = codec->spec; |
| 8662 | int val = !!*ucontrol->value.integer.value; |
| 8663 | |
| 8664 | if (val == spec->master_sw) |
| 8665 | return 0; |
| 8666 | spec->master_sw = val; |
| 8667 | alc262_hp_master_update(codec); |
| 8668 | return 1; |
| 8669 | } |
| 8670 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8671 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8672 | { |
| 8673 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8674 | .name = "Master Playback Switch", |
| 8675 | .info = snd_ctl_boolean_mono_info, |
| 8676 | .get = alc262_hp_master_sw_get, |
| 8677 | .put = alc262_hp_master_sw_put, |
| 8678 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8679 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8680 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8681 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8682 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8683 | HDA_OUTPUT), |
| 8684 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8685 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8686 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8687 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8688 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8689 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8690 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8691 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8692 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8693 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8694 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8695 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8696 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8697 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8698 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8699 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8700 | { } /* end */ |
| 8701 | }; |
| 8702 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8703 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8704 | { |
| 8705 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8706 | .name = "Master Playback Switch", |
| 8707 | .info = snd_ctl_boolean_mono_info, |
| 8708 | .get = alc262_hp_master_sw_get, |
| 8709 | .put = alc262_hp_master_sw_put, |
| 8710 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8711 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8712 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8713 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8714 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8715 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8716 | HDA_OUTPUT), |
| 8717 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8718 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8719 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8720 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8721 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8722 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8723 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8724 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8725 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8726 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8727 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8728 | { } /* end */ |
| 8729 | }; |
| 8730 | |
| 8731 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8732 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8733 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8734 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8735 | { } /* end */ |
| 8736 | }; |
| 8737 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8738 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8739 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8740 | { |
| 8741 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8742 | |
| 8743 | if (force || !spec->sense_updated) { |
| 8744 | unsigned int present; |
| 8745 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8746 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8747 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8748 | spec->sense_updated = 1; |
| 8749 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8750 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8751 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8752 | } |
| 8753 | |
| 8754 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8755 | unsigned int res) |
| 8756 | { |
| 8757 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8758 | return; |
| 8759 | alc262_hp_t5735_automute(codec, 1); |
| 8760 | } |
| 8761 | |
| 8762 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8763 | { |
| 8764 | alc262_hp_t5735_automute(codec, 1); |
| 8765 | } |
| 8766 | |
| 8767 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8768 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8769 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8770 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8771 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8772 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8773 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8774 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8775 | { } /* end */ |
| 8776 | }; |
| 8777 | |
| 8778 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8779 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8780 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8781 | |
| 8782 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8783 | { } |
| 8784 | }; |
| 8785 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8786 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8787 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8788 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8789 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8790 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8791 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8792 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8793 | { } /* end */ |
| 8794 | }; |
| 8795 | |
| 8796 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8797 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8798 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8799 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8800 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8801 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8802 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8803 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8804 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8805 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8806 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8807 | {} |
| 8808 | }; |
| 8809 | |
| 8810 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8811 | .num_items = 1, |
| 8812 | .items = { |
| 8813 | { "Line", 0x1 }, |
| 8814 | }, |
| 8815 | }; |
| 8816 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8817 | /* bind hp and internal speaker mute (with plug check) */ |
| 8818 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8819 | struct snd_ctl_elem_value *ucontrol) |
| 8820 | { |
| 8821 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8822 | long *valp = ucontrol->value.integer.value; |
| 8823 | int change; |
| 8824 | |
| 8825 | /* change hp mute */ |
| 8826 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8827 | HDA_AMP_MUTE, |
| 8828 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8829 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8830 | HDA_AMP_MUTE, |
| 8831 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8832 | if (change) { |
| 8833 | /* change speaker according to HP jack state */ |
| 8834 | struct alc_spec *spec = codec->spec; |
| 8835 | unsigned int mute; |
| 8836 | if (spec->jack_present) |
| 8837 | mute = HDA_AMP_MUTE; |
| 8838 | else |
| 8839 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8840 | HDA_OUTPUT, 0); |
| 8841 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8842 | HDA_AMP_MUTE, mute); |
| 8843 | } |
| 8844 | return change; |
| 8845 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8846 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8847 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8848 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8849 | { |
| 8850 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8851 | .name = "Master Playback Switch", |
| 8852 | .info = snd_hda_mixer_amp_switch_info, |
| 8853 | .get = snd_hda_mixer_amp_switch_get, |
| 8854 | .put = alc262_sony_master_sw_put, |
| 8855 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8856 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8857 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8858 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8859 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8860 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8861 | { } /* end */ |
| 8862 | }; |
| 8863 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8864 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8865 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8866 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8867 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8868 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8869 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8870 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8871 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8872 | { } /* end */ |
| 8873 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8874 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8875 | #define alc262_capture_mixer alc882_capture_mixer |
| 8876 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8877 | |
| 8878 | /* |
| 8879 | * generic initialization of ADC, input mixers and output mixers |
| 8880 | */ |
| 8881 | static struct hda_verb alc262_init_verbs[] = { |
| 8882 | /* |
| 8883 | * Unmute ADC0-2 and set the default input to mic-in |
| 8884 | */ |
| 8885 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8886 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8887 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8888 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8889 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8890 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8891 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8892 | /* 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] | 8893 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8894 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8895 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8896 | */ |
| 8897 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8898 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8899 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8900 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8901 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8902 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8903 | |
| 8904 | /* |
| 8905 | * Set up output mixers (0x0c - 0x0e) |
| 8906 | */ |
| 8907 | /* set vol=0 to output mixers */ |
| 8908 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8909 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8910 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8911 | /* set up input amps for analog loopback */ |
| 8912 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8913 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8914 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8915 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8916 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8917 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8918 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8919 | |
| 8920 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8921 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8922 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8923 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8924 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8925 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8926 | |
| 8927 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8929 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8930 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8931 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8932 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8933 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8934 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8935 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8936 | /* FIXME: use matrix-type input source selection */ |
| 8937 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8938 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8939 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8940 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8941 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8942 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8943 | /* Input mixer2 */ |
| 8944 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8945 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8946 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8947 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8948 | /* Input mixer3 */ |
| 8949 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8950 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8951 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8952 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8953 | |
| 8954 | { } |
| 8955 | }; |
| 8956 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 8957 | static struct hda_verb alc262_eapd_verbs[] = { |
| 8958 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8959 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8960 | { } |
| 8961 | }; |
| 8962 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8963 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8964 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8965 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8966 | {} |
| 8967 | }; |
| 8968 | |
| 8969 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8970 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8971 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8972 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8973 | |
| 8974 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8975 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8976 | {} |
| 8977 | }; |
| 8978 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8979 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8980 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8981 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8982 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8983 | |
| 8984 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8985 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 8986 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8987 | }; |
| 8988 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 8989 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 8990 | .num_items = 2, |
| 8991 | .items = { |
| 8992 | { "Int DMic", 0x9 }, |
| 8993 | { "Mic", 0x0 }, |
| 8994 | }, |
| 8995 | }; |
| 8996 | |
| 8997 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 8998 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8999 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9000 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9001 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9003 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9004 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9005 | { |
| 9006 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9007 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9008 | * So call somewhat different.. |
| 9009 | */ |
| 9010 | /* .name = "Capture Source", */ |
| 9011 | .name = "Input Source", |
| 9012 | .count = 1, |
| 9013 | .info = alc_mux_enum_info, |
| 9014 | .get = alc_mux_enum_get, |
| 9015 | .put = alc_mux_enum_put, |
| 9016 | }, |
| 9017 | { } /* end */ |
| 9018 | }; |
| 9019 | |
| 9020 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9021 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9022 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9023 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9024 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9025 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9026 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9027 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9028 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9029 | {} |
| 9030 | }; |
| 9031 | |
| 9032 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9033 | { |
| 9034 | unsigned int present; |
| 9035 | |
| 9036 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9037 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9038 | snd_hda_codec_write(codec, 0x22, 0, |
| 9039 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9040 | } |
| 9041 | |
| 9042 | /* toggle speaker-output according to the hp-jack state */ |
| 9043 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9044 | { |
| 9045 | unsigned int present; |
| 9046 | unsigned char bits; |
| 9047 | |
| 9048 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9049 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9050 | bits = present ? 0 : PIN_OUT; |
| 9051 | snd_hda_codec_write(codec, 0x14, 0, |
| 9052 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9053 | } |
| 9054 | |
| 9055 | |
| 9056 | |
| 9057 | /* unsolicited event for HP jack sensing */ |
| 9058 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9059 | unsigned int res) |
| 9060 | { |
| 9061 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9062 | alc262_toshiba_s06_speaker_automute(codec); |
| 9063 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9064 | alc262_dmic_automute(codec); |
| 9065 | |
| 9066 | } |
| 9067 | |
| 9068 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9069 | { |
| 9070 | alc262_toshiba_s06_speaker_automute(codec); |
| 9071 | alc262_dmic_automute(codec); |
| 9072 | } |
| 9073 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9074 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9075 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9076 | { |
| 9077 | struct alc_spec *spec = codec->spec; |
| 9078 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9079 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9080 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9081 | /* need to execute and sync at first */ |
| 9082 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9083 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9084 | AC_VERB_GET_PIN_SENSE, 0); |
| 9085 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9086 | if (spec->jack_present) { |
| 9087 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9088 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9089 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9090 | } else { |
| 9091 | /* unmute internal speaker if necessary */ |
| 9092 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9093 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9094 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9095 | } |
| 9096 | } |
| 9097 | |
| 9098 | /* unsolicited event for HP jack sensing */ |
| 9099 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9100 | unsigned int res) |
| 9101 | { |
| 9102 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9103 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9104 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9105 | } |
| 9106 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9107 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9108 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9109 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9110 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9111 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9112 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9113 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9114 | AC_VERB_GET_PIN_SENSE, 0); |
| 9115 | present = (present & 0x80000000) != 0; |
| 9116 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9117 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9118 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9119 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9120 | } else { |
| 9121 | /* unmute internal speaker if necessary */ |
| 9122 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9123 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9124 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9125 | } |
| 9126 | } |
| 9127 | |
| 9128 | /* unsolicited event for HP jack sensing */ |
| 9129 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9130 | unsigned int res) |
| 9131 | { |
| 9132 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9133 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9134 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9135 | } |
| 9136 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9137 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9138 | * nec model |
| 9139 | * 0x15 = headphone |
| 9140 | * 0x16 = internal speaker |
| 9141 | * 0x18 = external mic |
| 9142 | */ |
| 9143 | |
| 9144 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9145 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9146 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9147 | |
| 9148 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9149 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9150 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9151 | |
| 9152 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9153 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9154 | { } /* end */ |
| 9155 | }; |
| 9156 | |
| 9157 | static struct hda_verb alc262_nec_verbs[] = { |
| 9158 | /* Unmute Speaker */ |
| 9159 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9160 | |
| 9161 | /* Headphone */ |
| 9162 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9163 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9164 | |
| 9165 | /* External mic to headphone */ |
| 9166 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9167 | /* External mic to speaker */ |
| 9168 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9169 | {} |
| 9170 | }; |
| 9171 | |
| 9172 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9173 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9174 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9175 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9176 | */ |
| 9177 | |
| 9178 | #define ALC_HP_EVENT 0x37 |
| 9179 | |
| 9180 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9181 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9182 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9183 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9184 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9185 | {} |
| 9186 | }; |
| 9187 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9188 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9189 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9190 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9191 | {} |
| 9192 | }; |
| 9193 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9194 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9195 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9196 | .items = { |
| 9197 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9198 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9199 | { "CD", 0x4 }, |
| 9200 | }, |
| 9201 | }; |
| 9202 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9203 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9204 | .num_items = 5, |
| 9205 | .items = { |
| 9206 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9207 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9208 | { "Line", 0x2 }, |
| 9209 | { "CD", 0x4 }, |
| 9210 | { "AUX IN", 0x6 }, |
| 9211 | }, |
| 9212 | }; |
| 9213 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9214 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9215 | .num_items = 4, |
| 9216 | .items = { |
| 9217 | { "Mic", 0x0 }, |
| 9218 | { "Front Mic", 0x2 }, |
| 9219 | { "Line", 0x1 }, |
| 9220 | { "CD", 0x4 }, |
| 9221 | }, |
| 9222 | }; |
| 9223 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9224 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9225 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9226 | { |
| 9227 | struct alc_spec *spec = codec->spec; |
| 9228 | unsigned int mute; |
| 9229 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9230 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9231 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9232 | /* need to execute and sync at first */ |
| 9233 | 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] | 9234 | /* check laptop HP jack */ |
| 9235 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9236 | AC_VERB_GET_PIN_SENSE, 0); |
| 9237 | /* need to execute and sync at first */ |
| 9238 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9239 | /* check docking HP jack */ |
| 9240 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9241 | AC_VERB_GET_PIN_SENSE, 0); |
| 9242 | if (present & AC_PINSENSE_PRESENCE) |
| 9243 | spec->jack_present = 1; |
| 9244 | else |
| 9245 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9246 | spec->sense_updated = 1; |
| 9247 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9248 | /* unmute internal speaker only if both HPs are unplugged and |
| 9249 | * master switch is on |
| 9250 | */ |
| 9251 | if (spec->jack_present) |
| 9252 | mute = HDA_AMP_MUTE; |
| 9253 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9254 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9255 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9256 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9257 | } |
| 9258 | |
| 9259 | /* unsolicited event for HP jack sensing */ |
| 9260 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9261 | unsigned int res) |
| 9262 | { |
| 9263 | if ((res >> 26) != ALC_HP_EVENT) |
| 9264 | return; |
| 9265 | alc262_fujitsu_automute(codec, 1); |
| 9266 | } |
| 9267 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9268 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9269 | { |
| 9270 | alc262_fujitsu_automute(codec, 1); |
| 9271 | } |
| 9272 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9273 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9274 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 9275 | .ops = &snd_hda_bind_vol, |
| 9276 | .values = { |
| 9277 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 9278 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 9279 | 0 |
| 9280 | }, |
| 9281 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9282 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9283 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9284 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 9285 | { |
| 9286 | struct alc_spec *spec = codec->spec; |
| 9287 | unsigned int mute; |
| 9288 | |
| 9289 | if (force || !spec->sense_updated) { |
| 9290 | unsigned int present_int_hp; |
| 9291 | /* need to execute and sync at first */ |
| 9292 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9293 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 9294 | AC_VERB_GET_PIN_SENSE, 0); |
| 9295 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 9296 | spec->sense_updated = 1; |
| 9297 | } |
| 9298 | if (spec->jack_present) { |
| 9299 | /* mute internal speaker */ |
| 9300 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9301 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9302 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9303 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9304 | } else { |
| 9305 | /* unmute internal speaker if necessary */ |
| 9306 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9307 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9308 | HDA_AMP_MUTE, mute); |
| 9309 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9310 | HDA_AMP_MUTE, mute); |
| 9311 | } |
| 9312 | } |
| 9313 | |
| 9314 | /* unsolicited event for HP jack sensing */ |
| 9315 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 9316 | unsigned int res) |
| 9317 | { |
| 9318 | if ((res >> 26) != ALC_HP_EVENT) |
| 9319 | return; |
| 9320 | alc262_lenovo_3000_automute(codec, 1); |
| 9321 | } |
| 9322 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9323 | /* bind hp and internal speaker mute (with plug check) */ |
| 9324 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9325 | struct snd_ctl_elem_value *ucontrol) |
| 9326 | { |
| 9327 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9328 | long *valp = ucontrol->value.integer.value; |
| 9329 | int change; |
| 9330 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9331 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9332 | HDA_AMP_MUTE, |
| 9333 | valp ? 0 : HDA_AMP_MUTE); |
| 9334 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9335 | HDA_AMP_MUTE, |
| 9336 | valp ? 0 : HDA_AMP_MUTE); |
| 9337 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 9338 | if (change) |
| 9339 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9340 | return change; |
| 9341 | } |
| 9342 | |
| 9343 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9344 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9345 | { |
| 9346 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9347 | .name = "Master Playback Switch", |
| 9348 | .info = snd_hda_mixer_amp_switch_info, |
| 9349 | .get = snd_hda_mixer_amp_switch_get, |
| 9350 | .put = alc262_fujitsu_master_sw_put, |
| 9351 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9352 | }, |
| 9353 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9354 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 9355 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 9356 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9357 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9358 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9359 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9360 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9361 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9362 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9363 | { } /* end */ |
| 9364 | }; |
| 9365 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9366 | /* bind hp and internal speaker mute (with plug check) */ |
| 9367 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9368 | struct snd_ctl_elem_value *ucontrol) |
| 9369 | { |
| 9370 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9371 | long *valp = ucontrol->value.integer.value; |
| 9372 | int change; |
| 9373 | |
| 9374 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9375 | HDA_AMP_MUTE, |
| 9376 | valp ? 0 : HDA_AMP_MUTE); |
| 9377 | |
| 9378 | if (change) |
| 9379 | alc262_lenovo_3000_automute(codec, 0); |
| 9380 | return change; |
| 9381 | } |
| 9382 | |
| 9383 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 9384 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9385 | { |
| 9386 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9387 | .name = "Master Playback Switch", |
| 9388 | .info = snd_hda_mixer_amp_switch_info, |
| 9389 | .get = snd_hda_mixer_amp_switch_get, |
| 9390 | .put = alc262_lenovo_3000_master_sw_put, |
| 9391 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 9392 | }, |
| 9393 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9394 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9395 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9396 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9397 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9398 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9399 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9400 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9401 | { } /* end */ |
| 9402 | }; |
| 9403 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9404 | /* additional init verbs for Benq laptops */ |
| 9405 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 9406 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9407 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9408 | {} |
| 9409 | }; |
| 9410 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9411 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 9412 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9413 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9414 | |
| 9415 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9416 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 9417 | {} |
| 9418 | }; |
| 9419 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9420 | /* Samsung Q1 Ultra Vista model setup */ |
| 9421 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9422 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9423 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9424 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9425 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9426 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9427 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9428 | { } /* end */ |
| 9429 | }; |
| 9430 | |
| 9431 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9432 | /* output mixer */ |
| 9433 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9434 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9435 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9436 | /* speaker */ |
| 9437 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9438 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9439 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9440 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9441 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9442 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9443 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9444 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9445 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9446 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9447 | /* internal mic */ |
| 9448 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9449 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9450 | /* ADC, choose mic */ |
| 9451 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9452 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9453 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9454 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9455 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9456 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9457 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9458 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9459 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 9460 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9461 | {} |
| 9462 | }; |
| 9463 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9464 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9465 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9466 | { |
| 9467 | struct alc_spec *spec = codec->spec; |
| 9468 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9469 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9470 | mute = 0; |
| 9471 | /* auto-mute only when HP is used as HP */ |
| 9472 | if (!spec->cur_mux[0]) { |
| 9473 | unsigned int present; |
| 9474 | /* need to execute and sync at first */ |
| 9475 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9476 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9477 | AC_VERB_GET_PIN_SENSE, 0); |
| 9478 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9479 | if (spec->jack_present) |
| 9480 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9481 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9482 | /* mute/unmute internal speaker */ |
| 9483 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9484 | HDA_AMP_MUTE, mute); |
| 9485 | /* mute/unmute HP */ |
| 9486 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9487 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9488 | } |
| 9489 | |
| 9490 | /* unsolicited event for HP jack sensing */ |
| 9491 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9492 | unsigned int res) |
| 9493 | { |
| 9494 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9495 | return; |
| 9496 | alc262_ultra_automute(codec); |
| 9497 | } |
| 9498 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9499 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9500 | .num_items = 2, |
| 9501 | .items = { |
| 9502 | { "Mic", 0x1 }, |
| 9503 | { "Headphone", 0x7 }, |
| 9504 | }, |
| 9505 | }; |
| 9506 | |
| 9507 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9508 | struct snd_ctl_elem_value *ucontrol) |
| 9509 | { |
| 9510 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9511 | struct alc_spec *spec = codec->spec; |
| 9512 | int ret; |
| 9513 | |
| 9514 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 9515 | if (!ret) |
| 9516 | return 0; |
| 9517 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9518 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9519 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9520 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9521 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9522 | return ret; |
| 9523 | } |
| 9524 | |
| 9525 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9526 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9527 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9528 | { |
| 9529 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9530 | .name = "Capture Source", |
| 9531 | .info = alc882_mux_enum_info, |
| 9532 | .get = alc882_mux_enum_get, |
| 9533 | .put = alc262_ultra_mux_enum_put, |
| 9534 | }, |
| 9535 | { } /* end */ |
| 9536 | }; |
| 9537 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9538 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9539 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9540 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9541 | { |
| 9542 | hda_nid_t nid; |
| 9543 | int err; |
| 9544 | |
| 9545 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9546 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9547 | spec->multiout.dac_nids[0] = 2; |
| 9548 | |
| 9549 | nid = cfg->line_out_pins[0]; |
| 9550 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9551 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9552 | "Front Playback Volume", |
| 9553 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9554 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9555 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9556 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9557 | "Front Playback Switch", |
| 9558 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9559 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9560 | return err; |
| 9561 | } |
| 9562 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9563 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9564 | if (nid) { |
| 9565 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9566 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9567 | "Speaker Playback Volume", |
| 9568 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9569 | HDA_OUTPUT)); |
| 9570 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9571 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9572 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9573 | "Speaker Playback Switch", |
| 9574 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9575 | HDA_OUTPUT)); |
| 9576 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9577 | return err; |
| 9578 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9579 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9580 | "Speaker Playback Switch", |
| 9581 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9582 | HDA_OUTPUT)); |
| 9583 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9584 | return err; |
| 9585 | } |
| 9586 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9587 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9588 | if (nid) { |
| 9589 | /* spec->multiout.hp_nid = 2; */ |
| 9590 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9591 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9592 | "Headphone Playback Volume", |
| 9593 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9594 | HDA_OUTPUT)); |
| 9595 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9596 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9597 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9598 | "Headphone Playback Switch", |
| 9599 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9600 | HDA_OUTPUT)); |
| 9601 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9602 | return err; |
| 9603 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9604 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9605 | "Headphone Playback Switch", |
| 9606 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9607 | HDA_OUTPUT)); |
| 9608 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9609 | return err; |
| 9610 | } |
| 9611 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9612 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9613 | } |
| 9614 | |
| 9615 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9616 | #define alc262_auto_create_analog_input_ctls \ |
| 9617 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9618 | |
| 9619 | /* |
| 9620 | * generic initialization of ADC, input mixers and output mixers |
| 9621 | */ |
| 9622 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9623 | /* |
| 9624 | * Unmute ADC0-2 and set the default input to mic-in |
| 9625 | */ |
| 9626 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9627 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9628 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9629 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9630 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9631 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9632 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9633 | /* 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] | 9634 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9635 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9636 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9637 | */ |
| 9638 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9639 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9641 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9642 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9643 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9644 | |
| 9645 | /* |
| 9646 | * Set up output mixers (0x0c - 0x0f) |
| 9647 | */ |
| 9648 | /* set vol=0 to output mixers */ |
| 9649 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9650 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9651 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9652 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9653 | /* set up input amps for analog loopback */ |
| 9654 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9655 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9656 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9657 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9658 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9659 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9660 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9661 | |
| 9662 | /* FIXME: use matrix-type input source selection */ |
| 9663 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9664 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9665 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9666 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9667 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9668 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9669 | /* Input mixer2 */ |
| 9670 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9671 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9672 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9673 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9674 | /* Input mixer3 */ |
| 9675 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9676 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9677 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9678 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9679 | |
| 9680 | { } |
| 9681 | }; |
| 9682 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9683 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9684 | /* |
| 9685 | * Unmute ADC0-2 and set the default input to mic-in |
| 9686 | */ |
| 9687 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9688 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9689 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9690 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9691 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9692 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9693 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9694 | /* 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] | 9695 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9696 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9697 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9698 | */ |
| 9699 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9700 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9701 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9702 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9703 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9704 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9705 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9706 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9707 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9708 | /* |
| 9709 | * Set up output mixers (0x0c - 0x0e) |
| 9710 | */ |
| 9711 | /* set vol=0 to output mixers */ |
| 9712 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9713 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9714 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9715 | |
| 9716 | /* set up input amps for analog loopback */ |
| 9717 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9718 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9719 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9720 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9721 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9722 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9723 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9724 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9725 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9726 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9727 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9728 | |
| 9729 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9730 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9731 | |
| 9732 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9733 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9734 | |
| 9735 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9736 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9737 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9738 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9739 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9740 | |
| 9741 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9742 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9743 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9744 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9745 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9746 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9747 | |
| 9748 | |
| 9749 | /* FIXME: use matrix-type input source selection */ |
| 9750 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9751 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9752 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9753 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9754 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9755 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9756 | /* Input mixer2 */ |
| 9757 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9758 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9759 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9760 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9761 | /* Input mixer3 */ |
| 9762 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9763 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9764 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9765 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9766 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9767 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9768 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9769 | { } |
| 9770 | }; |
| 9771 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9772 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9773 | /* |
| 9774 | * Unmute ADC0-2 and set the default input to mic-in |
| 9775 | */ |
| 9776 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9777 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9778 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9779 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9780 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9781 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9782 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9783 | /* 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] | 9784 | * mixer widget |
| 9785 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9786 | * panel mic (mic 2) |
| 9787 | */ |
| 9788 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9789 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9790 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9791 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9792 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9793 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9794 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9795 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9796 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9797 | /* |
| 9798 | * Set up output mixers (0x0c - 0x0e) |
| 9799 | */ |
| 9800 | /* set vol=0 to output mixers */ |
| 9801 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9802 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9803 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9804 | |
| 9805 | /* set up input amps for analog loopback */ |
| 9806 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9807 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9808 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9809 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9810 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9811 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9812 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9813 | |
| 9814 | |
| 9815 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9816 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9817 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9818 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9819 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9820 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9821 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9822 | |
| 9823 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9824 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9825 | |
| 9826 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9827 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9828 | |
| 9829 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9830 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9831 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9832 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9833 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9834 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9835 | |
| 9836 | /* FIXME: use matrix-type input source selection */ |
| 9837 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9838 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9839 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9840 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9841 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9842 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9843 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9844 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9845 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9846 | /* Input mixer2 */ |
| 9847 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9848 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9849 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9850 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9851 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9852 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9853 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9854 | /* Input mixer3 */ |
| 9855 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9856 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9857 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9858 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9859 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9860 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9861 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9862 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9863 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9864 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9865 | { } |
| 9866 | }; |
| 9867 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9868 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9869 | #define alc262_loopbacks alc880_loopbacks |
| 9870 | #endif |
| 9871 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9872 | /* pcm configuration: identiacal with ALC880 */ |
| 9873 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9874 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9875 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9876 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9877 | |
| 9878 | /* |
| 9879 | * BIOS auto configuration |
| 9880 | */ |
| 9881 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9882 | { |
| 9883 | struct alc_spec *spec = codec->spec; |
| 9884 | int err; |
| 9885 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9886 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9887 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9888 | alc262_ignore); |
| 9889 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9890 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9891 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9892 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9893 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9894 | if (err < 0) |
| 9895 | return err; |
| 9896 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9897 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9898 | return err; |
| 9899 | |
| 9900 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9901 | |
| 9902 | if (spec->autocfg.dig_out_pin) |
| 9903 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9904 | if (spec->autocfg.dig_in_pin) |
| 9905 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9906 | |
| 9907 | if (spec->kctl_alloc) |
| 9908 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9909 | |
| 9910 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9911 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9912 | spec->input_mux = &spec->private_imux; |
| 9913 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9914 | err = alc_auto_add_mic_boost(codec); |
| 9915 | if (err < 0) |
| 9916 | return err; |
| 9917 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9918 | return 1; |
| 9919 | } |
| 9920 | |
| 9921 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9922 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9923 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9924 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9925 | |
| 9926 | |
| 9927 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9928 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9929 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9930 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9931 | alc262_auto_init_multi_out(codec); |
| 9932 | alc262_auto_init_hp_out(codec); |
| 9933 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9934 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9935 | if (spec->unsol_event) |
| 9936 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9937 | } |
| 9938 | |
| 9939 | /* |
| 9940 | * configuration and preset |
| 9941 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9942 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9943 | [ALC262_BASIC] = "basic", |
| 9944 | [ALC262_HIPPO] = "hippo", |
| 9945 | [ALC262_HIPPO_1] = "hippo_1", |
| 9946 | [ALC262_FUJITSU] = "fujitsu", |
| 9947 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9948 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9949 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9950 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9951 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9952 | [ALC262_BENQ_T31] = "benq-t31", |
| 9953 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9954 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9955 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9956 | [ALC262_NEC] = "nec", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9957 | [ALC262_AUTO] = "auto", |
| 9958 | }; |
| 9959 | |
| 9960 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9961 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9962 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9963 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9964 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9965 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9966 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9967 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9968 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9969 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9970 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9971 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9972 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9973 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9974 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9975 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9976 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9977 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9978 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9979 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9980 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9981 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9982 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9983 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9984 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9985 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9986 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9987 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9988 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9989 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 9990 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
| 9991 | ALC262_SONY_ASSAMD), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9992 | SND_PCI_QUIRK(0x1179, 0x0268, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9993 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9994 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9995 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9996 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9997 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9998 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9999 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10000 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10001 | {} |
| 10002 | }; |
| 10003 | |
| 10004 | static struct alc_config_preset alc262_presets[] = { |
| 10005 | [ALC262_BASIC] = { |
| 10006 | .mixers = { alc262_base_mixer }, |
| 10007 | .init_verbs = { alc262_init_verbs }, |
| 10008 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10009 | .dac_nids = alc262_dac_nids, |
| 10010 | .hp_nid = 0x03, |
| 10011 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10012 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10013 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10014 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10015 | [ALC262_HIPPO] = { |
| 10016 | .mixers = { alc262_base_mixer }, |
| 10017 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10018 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10019 | .dac_nids = alc262_dac_nids, |
| 10020 | .hp_nid = 0x03, |
| 10021 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10022 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10023 | .channel_mode = alc262_modes, |
| 10024 | .input_mux = &alc262_capture_source, |
| 10025 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10026 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10027 | }, |
| 10028 | [ALC262_HIPPO_1] = { |
| 10029 | .mixers = { alc262_hippo1_mixer }, |
| 10030 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10031 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10032 | .dac_nids = alc262_dac_nids, |
| 10033 | .hp_nid = 0x02, |
| 10034 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10035 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10036 | .channel_mode = alc262_modes, |
| 10037 | .input_mux = &alc262_capture_source, |
| 10038 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10039 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10040 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10041 | [ALC262_FUJITSU] = { |
| 10042 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10043 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10044 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10045 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10046 | .dac_nids = alc262_dac_nids, |
| 10047 | .hp_nid = 0x03, |
| 10048 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10049 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10050 | .channel_mode = alc262_modes, |
| 10051 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10052 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10053 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10054 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10055 | [ALC262_HP_BPC] = { |
| 10056 | .mixers = { alc262_HP_BPC_mixer }, |
| 10057 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10058 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10059 | .dac_nids = alc262_dac_nids, |
| 10060 | .hp_nid = 0x03, |
| 10061 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10062 | .channel_mode = alc262_modes, |
| 10063 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10064 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10065 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10066 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10067 | [ALC262_HP_BPC_D7000_WF] = { |
| 10068 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10069 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10070 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10071 | .dac_nids = alc262_dac_nids, |
| 10072 | .hp_nid = 0x03, |
| 10073 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10074 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10075 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10076 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10077 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10078 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10079 | [ALC262_HP_BPC_D7000_WL] = { |
| 10080 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10081 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10082 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10083 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10084 | .dac_nids = alc262_dac_nids, |
| 10085 | .hp_nid = 0x03, |
| 10086 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10087 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10088 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10089 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10090 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10091 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10092 | [ALC262_HP_TC_T5735] = { |
| 10093 | .mixers = { alc262_hp_t5735_mixer }, |
| 10094 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10095 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10096 | .dac_nids = alc262_dac_nids, |
| 10097 | .hp_nid = 0x03, |
| 10098 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10099 | .channel_mode = alc262_modes, |
| 10100 | .input_mux = &alc262_capture_source, |
| 10101 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10102 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10103 | }, |
| 10104 | [ALC262_HP_RP5700] = { |
| 10105 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10106 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10107 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10108 | .dac_nids = alc262_dac_nids, |
| 10109 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10110 | .channel_mode = alc262_modes, |
| 10111 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10112 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10113 | [ALC262_BENQ_ED8] = { |
| 10114 | .mixers = { alc262_base_mixer }, |
| 10115 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10116 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10117 | .dac_nids = alc262_dac_nids, |
| 10118 | .hp_nid = 0x03, |
| 10119 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10120 | .channel_mode = alc262_modes, |
| 10121 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10122 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10123 | [ALC262_SONY_ASSAMD] = { |
| 10124 | .mixers = { alc262_sony_mixer }, |
| 10125 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10126 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10127 | .dac_nids = alc262_dac_nids, |
| 10128 | .hp_nid = 0x02, |
| 10129 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10130 | .channel_mode = alc262_modes, |
| 10131 | .input_mux = &alc262_capture_source, |
| 10132 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10133 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10134 | }, |
| 10135 | [ALC262_BENQ_T31] = { |
| 10136 | .mixers = { alc262_benq_t31_mixer }, |
| 10137 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10138 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10139 | .dac_nids = alc262_dac_nids, |
| 10140 | .hp_nid = 0x03, |
| 10141 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10142 | .channel_mode = alc262_modes, |
| 10143 | .input_mux = &alc262_capture_source, |
| 10144 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10145 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10146 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10147 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10148 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 10149 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10150 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10151 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10152 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10153 | .channel_mode = alc262_modes, |
| 10154 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10155 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10156 | .capsrc_nids = alc262_capsrc_nids, |
| 10157 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10158 | .unsol_event = alc262_ultra_unsol_event, |
| 10159 | .init_hook = alc262_ultra_automute, |
| 10160 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10161 | [ALC262_LENOVO_3000] = { |
| 10162 | .mixers = { alc262_lenovo_3000_mixer }, |
| 10163 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10164 | alc262_lenovo_3000_unsol_verbs }, |
| 10165 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10166 | .dac_nids = alc262_dac_nids, |
| 10167 | .hp_nid = 0x03, |
| 10168 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10169 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10170 | .channel_mode = alc262_modes, |
| 10171 | .input_mux = &alc262_fujitsu_capture_source, |
| 10172 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 10173 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10174 | [ALC262_NEC] = { |
| 10175 | .mixers = { alc262_nec_mixer }, |
| 10176 | .init_verbs = { alc262_nec_verbs }, |
| 10177 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10178 | .dac_nids = alc262_dac_nids, |
| 10179 | .hp_nid = 0x03, |
| 10180 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10181 | .channel_mode = alc262_modes, |
| 10182 | .input_mux = &alc262_capture_source, |
| 10183 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10184 | [ALC262_TOSHIBA_S06] = { |
| 10185 | .mixers = { alc262_toshiba_s06_mixer }, |
| 10186 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 10187 | alc262_eapd_verbs }, |
| 10188 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10189 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 10190 | .dac_nids = alc262_dac_nids, |
| 10191 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 10192 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10193 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10194 | .channel_mode = alc262_modes, |
| 10195 | .input_mux = &alc262_dmic_capture_source, |
| 10196 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 10197 | .init_hook = alc262_toshiba_s06_init_hook, |
| 10198 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10199 | }; |
| 10200 | |
| 10201 | static int patch_alc262(struct hda_codec *codec) |
| 10202 | { |
| 10203 | struct alc_spec *spec; |
| 10204 | int board_config; |
| 10205 | int err; |
| 10206 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 10207 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10208 | if (spec == NULL) |
| 10209 | return -ENOMEM; |
| 10210 | |
| 10211 | codec->spec = spec; |
| 10212 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10213 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 10214 | * under-run |
| 10215 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10216 | { |
| 10217 | int tmp; |
| 10218 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10219 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 10220 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10221 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 10222 | } |
| 10223 | #endif |
| 10224 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 10225 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10226 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10227 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 10228 | alc262_models, |
| 10229 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10230 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10231 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10232 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 10233 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10234 | board_config = ALC262_AUTO; |
| 10235 | } |
| 10236 | |
| 10237 | if (board_config == ALC262_AUTO) { |
| 10238 | /* automatic parse from the BIOS config */ |
| 10239 | err = alc262_parse_auto_config(codec); |
| 10240 | if (err < 0) { |
| 10241 | alc_free(codec); |
| 10242 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10243 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10244 | printk(KERN_INFO |
| 10245 | "hda_codec: Cannot set up configuration " |
| 10246 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10247 | board_config = ALC262_BASIC; |
| 10248 | } |
| 10249 | } |
| 10250 | |
| 10251 | if (board_config != ALC262_AUTO) |
| 10252 | setup_preset(spec, &alc262_presets[board_config]); |
| 10253 | |
| 10254 | spec->stream_name_analog = "ALC262 Analog"; |
| 10255 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 10256 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10257 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10258 | spec->stream_name_digital = "ALC262 Digital"; |
| 10259 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 10260 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 10261 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10262 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10263 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 10264 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 10265 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10266 | /* get type */ |
| 10267 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10268 | if (wcap != AC_WID_AUD_IN) { |
| 10269 | spec->adc_nids = alc262_adc_nids_alt; |
| 10270 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10271 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10272 | spec->mixers[spec->num_mixers] = |
| 10273 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10274 | spec->num_mixers++; |
| 10275 | } else { |
| 10276 | spec->adc_nids = alc262_adc_nids; |
| 10277 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10278 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10279 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 10280 | spec->num_mixers++; |
| 10281 | } |
| 10282 | } |
| 10283 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10284 | spec->vmaster_nid = 0x0c; |
| 10285 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10286 | codec->patch_ops = alc_patch_ops; |
| 10287 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10288 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10289 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10290 | if (!spec->loopback.amplist) |
| 10291 | spec->loopback.amplist = alc262_loopbacks; |
| 10292 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10293 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10294 | return 0; |
| 10295 | } |
| 10296 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10297 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10298 | * ALC268 channel source setting (2 channel) |
| 10299 | */ |
| 10300 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 10301 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10302 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10303 | static hda_nid_t alc268_dac_nids[2] = { |
| 10304 | /* front, hp */ |
| 10305 | 0x02, 0x03 |
| 10306 | }; |
| 10307 | |
| 10308 | static hda_nid_t alc268_adc_nids[2] = { |
| 10309 | /* ADC0-1 */ |
| 10310 | 0x08, 0x07 |
| 10311 | }; |
| 10312 | |
| 10313 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 10314 | /* ADC0 */ |
| 10315 | 0x08 |
| 10316 | }; |
| 10317 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10318 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 10319 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10320 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 10321 | /* output mixer control */ |
| 10322 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10323 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10324 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10325 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10326 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10327 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10328 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10329 | { } |
| 10330 | }; |
| 10331 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10332 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 10333 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 10334 | .ops = &snd_hda_bind_sw, |
| 10335 | .values = { |
| 10336 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 10337 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 10338 | 0 |
| 10339 | }, |
| 10340 | }; |
| 10341 | |
| 10342 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 10343 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 10344 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 10345 | { } |
| 10346 | }; |
| 10347 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10348 | static struct hda_verb alc268_eapd_verbs[] = { |
| 10349 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10350 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10351 | { } |
| 10352 | }; |
| 10353 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10354 | /* Toshiba specific */ |
| 10355 | #define alc268_toshiba_automute alc262_hippo_automute |
| 10356 | |
| 10357 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 10358 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10359 | { } /* end */ |
| 10360 | }; |
| 10361 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame^] | 10362 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 10363 | .num_items = 2, |
| 10364 | .items = { |
| 10365 | { "i-Mic", 0x6 }, |
| 10366 | { "E-Mic", 0x0 }, |
| 10367 | }, |
| 10368 | }; |
| 10369 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10370 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10371 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 10372 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 10373 | .ops = &snd_hda_bind_vol, |
| 10374 | .values = { |
| 10375 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 10376 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 10377 | 0 |
| 10378 | }, |
| 10379 | }; |
| 10380 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10381 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10382 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 10383 | { |
| 10384 | struct alc_spec *spec = codec->spec; |
| 10385 | unsigned int mute; |
| 10386 | |
| 10387 | if (force || !spec->sense_updated) { |
| 10388 | unsigned int present; |
| 10389 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10390 | AC_VERB_GET_PIN_SENSE, 0); |
| 10391 | spec->jack_present = (present & 0x80000000) != 0; |
| 10392 | spec->sense_updated = 1; |
| 10393 | } |
| 10394 | if (spec->jack_present) |
| 10395 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 10396 | else /* unmute internal speaker if necessary */ |
| 10397 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 10398 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10399 | HDA_AMP_MUTE, mute); |
| 10400 | } |
| 10401 | |
| 10402 | |
| 10403 | /* bind hp and internal speaker mute (with plug check) */ |
| 10404 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10405 | struct snd_ctl_elem_value *ucontrol) |
| 10406 | { |
| 10407 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10408 | long *valp = ucontrol->value.integer.value; |
| 10409 | int change; |
| 10410 | |
| 10411 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10412 | HDA_AMP_MUTE, |
| 10413 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 10414 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10415 | HDA_AMP_MUTE, |
| 10416 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 10417 | if (change) |
| 10418 | alc268_acer_automute(codec, 0); |
| 10419 | return change; |
| 10420 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10421 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame^] | 10422 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 10423 | /* output mixer control */ |
| 10424 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10425 | { |
| 10426 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10427 | .name = "Master Playback Switch", |
| 10428 | .info = snd_hda_mixer_amp_switch_info, |
| 10429 | .get = snd_hda_mixer_amp_switch_get, |
| 10430 | .put = alc268_acer_master_sw_put, |
| 10431 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10432 | }, |
| 10433 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 10434 | { } |
| 10435 | }; |
| 10436 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10437 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 10438 | /* output mixer control */ |
| 10439 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10440 | { |
| 10441 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10442 | .name = "Master Playback Switch", |
| 10443 | .info = snd_hda_mixer_amp_switch_info, |
| 10444 | .get = snd_hda_mixer_amp_switch_get, |
| 10445 | .put = alc268_acer_master_sw_put, |
| 10446 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10447 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10448 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10449 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10450 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10451 | { } |
| 10452 | }; |
| 10453 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame^] | 10454 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 10455 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10456 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10457 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10458 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10459 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 10460 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 10461 | { } |
| 10462 | }; |
| 10463 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10464 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10465 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 10466 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10467 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10468 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10469 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10470 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10471 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10472 | { } |
| 10473 | }; |
| 10474 | |
| 10475 | /* unsolicited event for HP jack sensing */ |
| 10476 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 10477 | unsigned int res) |
| 10478 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10479 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10480 | return; |
| 10481 | alc268_toshiba_automute(codec); |
| 10482 | } |
| 10483 | |
| 10484 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 10485 | unsigned int res) |
| 10486 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10487 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10488 | return; |
| 10489 | alc268_acer_automute(codec, 1); |
| 10490 | } |
| 10491 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10492 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 10493 | { |
| 10494 | alc268_acer_automute(codec, 1); |
| 10495 | } |
| 10496 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame^] | 10497 | /* toggle speaker-output according to the hp-jack state */ |
| 10498 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 10499 | { |
| 10500 | unsigned int present; |
| 10501 | unsigned char bits; |
| 10502 | |
| 10503 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10504 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10505 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 10506 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 10507 | AMP_IN_MUTE(0), bits); |
| 10508 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 10509 | AMP_IN_MUTE(0), bits); |
| 10510 | } |
| 10511 | |
| 10512 | |
| 10513 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 10514 | { |
| 10515 | unsigned int present; |
| 10516 | |
| 10517 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10518 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10519 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 10520 | present ? 0x0 : 0x6); |
| 10521 | } |
| 10522 | |
| 10523 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 10524 | unsigned int res) |
| 10525 | { |
| 10526 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10527 | alc268_aspire_one_speaker_automute(codec); |
| 10528 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10529 | alc268_acer_mic_automute(codec); |
| 10530 | } |
| 10531 | |
| 10532 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 10533 | { |
| 10534 | alc268_aspire_one_speaker_automute(codec); |
| 10535 | alc268_acer_mic_automute(codec); |
| 10536 | } |
| 10537 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10538 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 10539 | /* output mixer control */ |
| 10540 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10541 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10542 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10543 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10544 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10545 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10546 | { } |
| 10547 | }; |
| 10548 | |
| 10549 | static struct hda_verb alc268_dell_verbs[] = { |
| 10550 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10551 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10552 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10553 | { } |
| 10554 | }; |
| 10555 | |
| 10556 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10557 | static void alc268_dell_automute(struct hda_codec *codec) |
| 10558 | { |
| 10559 | unsigned int present; |
| 10560 | unsigned int mute; |
| 10561 | |
| 10562 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 10563 | if (present & 0x80000000) |
| 10564 | mute = HDA_AMP_MUTE; |
| 10565 | else |
| 10566 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 10567 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10568 | HDA_AMP_MUTE, mute); |
| 10569 | } |
| 10570 | |
| 10571 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 10572 | unsigned int res) |
| 10573 | { |
| 10574 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10575 | return; |
| 10576 | alc268_dell_automute(codec); |
| 10577 | } |
| 10578 | |
| 10579 | #define alc268_dell_init_hook alc268_dell_automute |
| 10580 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10581 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 10582 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10583 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10584 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10585 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10586 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10587 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10588 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 10589 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10590 | { } |
| 10591 | }; |
| 10592 | |
| 10593 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 10594 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10595 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 10596 | { } |
| 10597 | }; |
| 10598 | |
| 10599 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 10600 | { |
| 10601 | unsigned int present; |
| 10602 | |
| 10603 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 10604 | & AC_PINSENSE_PRESENCE; |
| 10605 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10606 | present ? 0 : PIN_OUT); |
| 10607 | } |
| 10608 | |
| 10609 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 10610 | { |
| 10611 | unsigned int present; |
| 10612 | |
| 10613 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10614 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10615 | snd_hda_codec_write(codec, 0x23, 0, |
| 10616 | AC_VERB_SET_CONNECT_SEL, |
| 10617 | present ? 0x00 : 0x01); |
| 10618 | } |
| 10619 | |
| 10620 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 10621 | { |
| 10622 | alc267_quanta_il1_hp_automute(codec); |
| 10623 | alc267_quanta_il1_mic_automute(codec); |
| 10624 | } |
| 10625 | |
| 10626 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 10627 | unsigned int res) |
| 10628 | { |
| 10629 | switch (res >> 26) { |
| 10630 | case ALC880_HP_EVENT: |
| 10631 | alc267_quanta_il1_hp_automute(codec); |
| 10632 | break; |
| 10633 | case ALC880_MIC_EVENT: |
| 10634 | alc267_quanta_il1_mic_automute(codec); |
| 10635 | break; |
| 10636 | } |
| 10637 | } |
| 10638 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10639 | /* |
| 10640 | * generic initialization of ADC, input mixers and output mixers |
| 10641 | */ |
| 10642 | static struct hda_verb alc268_base_init_verbs[] = { |
| 10643 | /* Unmute DAC0-1 and set vol = 0 */ |
| 10644 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10645 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10646 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10647 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10648 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10649 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10650 | |
| 10651 | /* |
| 10652 | * Set up output mixers (0x0c - 0x0e) |
| 10653 | */ |
| 10654 | /* set vol=0 to output mixers */ |
| 10655 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10656 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10657 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10658 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10659 | |
| 10660 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10661 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10662 | |
| 10663 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10664 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10665 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10666 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10667 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10668 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10669 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10670 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10671 | |
| 10672 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10673 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10674 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10675 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10676 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10677 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10678 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10679 | |
| 10680 | /* set PCBEEP vol = 0, mute connections */ |
| 10681 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10682 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10683 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10684 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10685 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10686 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10687 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10688 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10689 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10690 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10691 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10692 | { } |
| 10693 | }; |
| 10694 | |
| 10695 | /* |
| 10696 | * generic initialization of ADC, input mixers and output mixers |
| 10697 | */ |
| 10698 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 10699 | /* set output DAC */ |
| 10700 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10701 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10702 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10703 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10704 | |
| 10705 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10706 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10707 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10708 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10709 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10710 | |
| 10711 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10712 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10713 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10714 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10715 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10716 | |
| 10717 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10718 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10719 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10720 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10721 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10722 | /* set PCBEEP vol = 0, mute connections */ |
| 10723 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10724 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10725 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10726 | |
| 10727 | { } |
| 10728 | }; |
| 10729 | |
| 10730 | #define alc268_mux_enum_info alc_mux_enum_info |
| 10731 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10732 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10733 | |
| 10734 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 10735 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10736 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10737 | { |
| 10738 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10739 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10740 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10741 | */ |
| 10742 | /* .name = "Capture Source", */ |
| 10743 | .name = "Input Source", |
| 10744 | .count = 1, |
| 10745 | .info = alc268_mux_enum_info, |
| 10746 | .get = alc268_mux_enum_get, |
| 10747 | .put = alc268_mux_enum_put, |
| 10748 | }, |
| 10749 | { } /* end */ |
| 10750 | }; |
| 10751 | |
| 10752 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 10753 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10754 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10755 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10756 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10757 | { |
| 10758 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10759 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10760 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10761 | */ |
| 10762 | /* .name = "Capture Source", */ |
| 10763 | .name = "Input Source", |
| 10764 | .count = 2, |
| 10765 | .info = alc268_mux_enum_info, |
| 10766 | .get = alc268_mux_enum_get, |
| 10767 | .put = alc268_mux_enum_put, |
| 10768 | }, |
| 10769 | { } /* end */ |
| 10770 | }; |
| 10771 | |
| 10772 | static struct hda_input_mux alc268_capture_source = { |
| 10773 | .num_items = 4, |
| 10774 | .items = { |
| 10775 | { "Mic", 0x0 }, |
| 10776 | { "Front Mic", 0x1 }, |
| 10777 | { "Line", 0x2 }, |
| 10778 | { "CD", 0x3 }, |
| 10779 | }, |
| 10780 | }; |
| 10781 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10782 | static struct hda_input_mux alc268_acer_capture_source = { |
| 10783 | .num_items = 3, |
| 10784 | .items = { |
| 10785 | { "Mic", 0x0 }, |
| 10786 | { "Internal Mic", 0x6 }, |
| 10787 | { "Line", 0x2 }, |
| 10788 | }, |
| 10789 | }; |
| 10790 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10791 | #ifdef CONFIG_SND_DEBUG |
| 10792 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10793 | /* Volume widgets */ |
| 10794 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10795 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10796 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10797 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10798 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 10799 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 10800 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 10801 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 10802 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 10803 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 10804 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 10805 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 10806 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 10807 | /* The below appears problematic on some hardwares */ |
| 10808 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10809 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10810 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10811 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 10812 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 10813 | |
| 10814 | /* Modes for retasking pin widgets */ |
| 10815 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 10816 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 10817 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 10818 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 10819 | |
| 10820 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 10821 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 10822 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 10823 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 10824 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 10825 | |
| 10826 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 10827 | * The ALC268 does not have an SPDIF input. |
| 10828 | */ |
| 10829 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 10830 | |
| 10831 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 10832 | * this output to turn on an external amplifier. |
| 10833 | */ |
| 10834 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 10835 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 10836 | |
| 10837 | { } /* end */ |
| 10838 | }; |
| 10839 | #endif |
| 10840 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10841 | /* create input playback/capture controls for the given pin */ |
| 10842 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 10843 | const char *ctlname, int idx) |
| 10844 | { |
| 10845 | char name[32]; |
| 10846 | int err; |
| 10847 | |
| 10848 | sprintf(name, "%s Playback Volume", ctlname); |
| 10849 | if (nid == 0x14) { |
| 10850 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10851 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 10852 | HDA_OUTPUT)); |
| 10853 | if (err < 0) |
| 10854 | return err; |
| 10855 | } else if (nid == 0x15) { |
| 10856 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10857 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 10858 | HDA_OUTPUT)); |
| 10859 | if (err < 0) |
| 10860 | return err; |
| 10861 | } else |
| 10862 | return -1; |
| 10863 | sprintf(name, "%s Playback Switch", ctlname); |
| 10864 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10865 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 10866 | if (err < 0) |
| 10867 | return err; |
| 10868 | return 0; |
| 10869 | } |
| 10870 | |
| 10871 | /* add playback controls from the parsed DAC table */ |
| 10872 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10873 | const struct auto_pin_cfg *cfg) |
| 10874 | { |
| 10875 | hda_nid_t nid; |
| 10876 | int err; |
| 10877 | |
| 10878 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 10879 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10880 | spec->multiout.dac_nids[0] = 2; |
| 10881 | spec->multiout.dac_nids[1] = 3; |
| 10882 | |
| 10883 | nid = cfg->line_out_pins[0]; |
| 10884 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10885 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10886 | |
| 10887 | nid = cfg->speaker_pins[0]; |
| 10888 | if (nid == 0x1d) { |
| 10889 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10890 | "Speaker Playback Volume", |
| 10891 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10892 | if (err < 0) |
| 10893 | return err; |
| 10894 | } |
| 10895 | nid = cfg->hp_pins[0]; |
| 10896 | if (nid) |
| 10897 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 10898 | |
| 10899 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 10900 | if (nid == 0x16) { |
| 10901 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10902 | "Mono Playback Switch", |
| 10903 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 10904 | if (err < 0) |
| 10905 | return err; |
| 10906 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10907 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10908 | } |
| 10909 | |
| 10910 | /* create playback/capture controls for input pins */ |
| 10911 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10912 | const struct auto_pin_cfg *cfg) |
| 10913 | { |
| 10914 | struct hda_input_mux *imux = &spec->private_imux; |
| 10915 | int i, idx1; |
| 10916 | |
| 10917 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10918 | switch(cfg->input_pins[i]) { |
| 10919 | case 0x18: |
| 10920 | idx1 = 0; /* Mic 1 */ |
| 10921 | break; |
| 10922 | case 0x19: |
| 10923 | idx1 = 1; /* Mic 2 */ |
| 10924 | break; |
| 10925 | case 0x1a: |
| 10926 | idx1 = 2; /* Line In */ |
| 10927 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10928 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10929 | idx1 = 3; /* CD */ |
| 10930 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 10931 | case 0x12: |
| 10932 | case 0x13: |
| 10933 | idx1 = 6; /* digital mics */ |
| 10934 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10935 | default: |
| 10936 | continue; |
| 10937 | } |
| 10938 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 10939 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10940 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10941 | } |
| 10942 | return 0; |
| 10943 | } |
| 10944 | |
| 10945 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 10946 | { |
| 10947 | struct alc_spec *spec = codec->spec; |
| 10948 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10949 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10950 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10951 | unsigned int dac_vol1, dac_vol2; |
| 10952 | |
| 10953 | if (speaker_nid) { |
| 10954 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 10955 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 10956 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10957 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10958 | AMP_IN_UNMUTE(1)); |
| 10959 | snd_hda_codec_write(codec, 0x10, 0, |
| 10960 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10961 | AMP_IN_UNMUTE(1)); |
| 10962 | } else { |
| 10963 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10964 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10965 | snd_hda_codec_write(codec, 0x10, 0, |
| 10966 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10967 | } |
| 10968 | |
| 10969 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10970 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10971 | dac_vol2 = AMP_OUT_ZERO; |
| 10972 | else if (line_nid == 0x15) |
| 10973 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10974 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10975 | dac_vol2 = AMP_OUT_ZERO; |
| 10976 | else if (hp_nid == 0x15) |
| 10977 | dac_vol1 = AMP_OUT_ZERO; |
| 10978 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10979 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10980 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10981 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10982 | |
| 10983 | snd_hda_codec_write(codec, 0x02, 0, |
| 10984 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10985 | snd_hda_codec_write(codec, 0x03, 0, |
| 10986 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10987 | } |
| 10988 | |
| 10989 | /* pcm configuration: identiacal with ALC880 */ |
| 10990 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10991 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10992 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10993 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10994 | |
| 10995 | /* |
| 10996 | * BIOS auto configuration |
| 10997 | */ |
| 10998 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10999 | { |
| 11000 | struct alc_spec *spec = codec->spec; |
| 11001 | int err; |
| 11002 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11003 | |
| 11004 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11005 | alc268_ignore); |
| 11006 | if (err < 0) |
| 11007 | return err; |
| 11008 | if (!spec->autocfg.line_outs) |
| 11009 | return 0; /* can't find valid BIOS pin config */ |
| 11010 | |
| 11011 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11012 | if (err < 0) |
| 11013 | return err; |
| 11014 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11015 | if (err < 0) |
| 11016 | return err; |
| 11017 | |
| 11018 | spec->multiout.max_channels = 2; |
| 11019 | |
| 11020 | /* digital only support output */ |
| 11021 | if (spec->autocfg.dig_out_pin) |
| 11022 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 11023 | |
| 11024 | if (spec->kctl_alloc) |
| 11025 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11026 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11027 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 11028 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 11029 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11030 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 11031 | spec->num_mux_defs = 1; |
| 11032 | spec->input_mux = &spec->private_imux; |
| 11033 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11034 | err = alc_auto_add_mic_boost(codec); |
| 11035 | if (err < 0) |
| 11036 | return err; |
| 11037 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11038 | return 1; |
| 11039 | } |
| 11040 | |
| 11041 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11042 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11043 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11044 | |
| 11045 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11046 | static void alc268_auto_init(struct hda_codec *codec) |
| 11047 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11048 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11049 | alc268_auto_init_multi_out(codec); |
| 11050 | alc268_auto_init_hp_out(codec); |
| 11051 | alc268_auto_init_mono_speaker_out(codec); |
| 11052 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11053 | if (spec->unsol_event) |
| 11054 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11055 | } |
| 11056 | |
| 11057 | /* |
| 11058 | * configuration and preset |
| 11059 | */ |
| 11060 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11061 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11062 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11063 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11064 | [ALC268_ACER] = "acer", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame^] | 11065 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11066 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11067 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11068 | #ifdef CONFIG_SND_DEBUG |
| 11069 | [ALC268_TEST] = "test", |
| 11070 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11071 | [ALC268_AUTO] = "auto", |
| 11072 | }; |
| 11073 | |
| 11074 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 11075 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11076 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11077 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11078 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11079 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame^] | 11080 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 11081 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11082 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11083 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11084 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11085 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11086 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11087 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11088 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11089 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11090 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11091 | {} |
| 11092 | }; |
| 11093 | |
| 11094 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11095 | [ALC267_QUANTA_IL1] = { |
| 11096 | .mixers = { alc267_quanta_il1_mixer }, |
| 11097 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11098 | alc267_quanta_il1_verbs }, |
| 11099 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11100 | .dac_nids = alc268_dac_nids, |
| 11101 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11102 | .adc_nids = alc268_adc_nids_alt, |
| 11103 | .hp_nid = 0x03, |
| 11104 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11105 | .channel_mode = alc268_modes, |
| 11106 | .input_mux = &alc268_capture_source, |
| 11107 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 11108 | .init_hook = alc267_quanta_il1_automute, |
| 11109 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11110 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11111 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11112 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11113 | .init_verbs = { alc268_base_init_verbs }, |
| 11114 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11115 | .dac_nids = alc268_dac_nids, |
| 11116 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11117 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11118 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11119 | .hp_nid = 0x03, |
| 11120 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11121 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11122 | .channel_mode = alc268_modes, |
| 11123 | .input_mux = &alc268_capture_source, |
| 11124 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11125 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11126 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11127 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11128 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11129 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11130 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11131 | .dac_nids = alc268_dac_nids, |
| 11132 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11133 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11134 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11135 | .hp_nid = 0x03, |
| 11136 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11137 | .channel_mode = alc268_modes, |
| 11138 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11139 | .unsol_event = alc268_toshiba_unsol_event, |
| 11140 | .init_hook = alc268_toshiba_automute, |
| 11141 | }, |
| 11142 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11143 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 11144 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11145 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11146 | alc268_acer_verbs }, |
| 11147 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11148 | .dac_nids = alc268_dac_nids, |
| 11149 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11150 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11151 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11152 | .hp_nid = 0x02, |
| 11153 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11154 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11155 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11156 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11157 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11158 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame^] | 11159 | [ALC268_ACER_ASPIRE_ONE] = { |
| 11160 | .mixers = { alc268_acer_aspire_one_mixer, |
| 11161 | alc268_capture_alt_mixer }, |
| 11162 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11163 | alc268_acer_aspire_one_verbs }, |
| 11164 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11165 | .dac_nids = alc268_dac_nids, |
| 11166 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11167 | .adc_nids = alc268_adc_nids_alt, |
| 11168 | .capsrc_nids = alc268_capsrc_nids, |
| 11169 | .hp_nid = 0x03, |
| 11170 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11171 | .channel_mode = alc268_modes, |
| 11172 | .input_mux = &alc268_acer_lc_capture_source, |
| 11173 | .unsol_event = alc268_acer_lc_unsol_event, |
| 11174 | .init_hook = alc268_acer_lc_init_hook, |
| 11175 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11176 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11177 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11178 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11179 | alc268_dell_verbs }, |
| 11180 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11181 | .dac_nids = alc268_dac_nids, |
| 11182 | .hp_nid = 0x02, |
| 11183 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11184 | .channel_mode = alc268_modes, |
| 11185 | .unsol_event = alc268_dell_unsol_event, |
| 11186 | .init_hook = alc268_dell_init_hook, |
| 11187 | .input_mux = &alc268_capture_source, |
| 11188 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11189 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11190 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11191 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11192 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11193 | alc268_toshiba_verbs }, |
| 11194 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11195 | .dac_nids = alc268_dac_nids, |
| 11196 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11197 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11198 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11199 | .hp_nid = 0x03, |
| 11200 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11201 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11202 | .channel_mode = alc268_modes, |
| 11203 | .input_mux = &alc268_capture_source, |
| 11204 | .unsol_event = alc268_toshiba_unsol_event, |
| 11205 | .init_hook = alc268_toshiba_automute |
| 11206 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11207 | #ifdef CONFIG_SND_DEBUG |
| 11208 | [ALC268_TEST] = { |
| 11209 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 11210 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11211 | alc268_volume_init_verbs }, |
| 11212 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11213 | .dac_nids = alc268_dac_nids, |
| 11214 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11215 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11216 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11217 | .hp_nid = 0x03, |
| 11218 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11219 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11220 | .channel_mode = alc268_modes, |
| 11221 | .input_mux = &alc268_capture_source, |
| 11222 | }, |
| 11223 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11224 | }; |
| 11225 | |
| 11226 | static int patch_alc268(struct hda_codec *codec) |
| 11227 | { |
| 11228 | struct alc_spec *spec; |
| 11229 | int board_config; |
| 11230 | int err; |
| 11231 | |
| 11232 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 11233 | if (spec == NULL) |
| 11234 | return -ENOMEM; |
| 11235 | |
| 11236 | codec->spec = spec; |
| 11237 | |
| 11238 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 11239 | alc268_models, |
| 11240 | alc268_cfg_tbl); |
| 11241 | |
| 11242 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 11243 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 11244 | "trying auto-probe from BIOS...\n"); |
| 11245 | board_config = ALC268_AUTO; |
| 11246 | } |
| 11247 | |
| 11248 | if (board_config == ALC268_AUTO) { |
| 11249 | /* automatic parse from the BIOS config */ |
| 11250 | err = alc268_parse_auto_config(codec); |
| 11251 | if (err < 0) { |
| 11252 | alc_free(codec); |
| 11253 | return err; |
| 11254 | } else if (!err) { |
| 11255 | printk(KERN_INFO |
| 11256 | "hda_codec: Cannot set up configuration " |
| 11257 | "from BIOS. Using base mode...\n"); |
| 11258 | board_config = ALC268_3ST; |
| 11259 | } |
| 11260 | } |
| 11261 | |
| 11262 | if (board_config != ALC268_AUTO) |
| 11263 | setup_preset(spec, &alc268_presets[board_config]); |
| 11264 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11265 | if (codec->vendor_id == 0x10ec0267) { |
| 11266 | spec->stream_name_analog = "ALC267 Analog"; |
| 11267 | spec->stream_name_digital = "ALC267 Digital"; |
| 11268 | } else { |
| 11269 | spec->stream_name_analog = "ALC268 Analog"; |
| 11270 | spec->stream_name_digital = "ALC268 Digital"; |
| 11271 | } |
| 11272 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11273 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 11274 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11275 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11276 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11277 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 11278 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11279 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 11280 | /* override the amp caps for beep generator */ |
| 11281 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 11282 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 11283 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 11284 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 11285 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 11286 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11287 | if (!spec->adc_nids && spec->input_mux) { |
| 11288 | /* check whether NID 0x07 is valid */ |
| 11289 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11290 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11291 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11292 | /* get type */ |
| 11293 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 11294 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11295 | spec->adc_nids = alc268_adc_nids_alt; |
| 11296 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 11297 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11298 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11299 | spec->num_mixers++; |
| 11300 | } else { |
| 11301 | spec->adc_nids = alc268_adc_nids; |
| 11302 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 11303 | spec->mixers[spec->num_mixers] = |
| 11304 | alc268_capture_mixer; |
| 11305 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11306 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11307 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11308 | /* set default input source */ |
| 11309 | for (i = 0; i < spec->num_adc_nids; i++) |
| 11310 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 11311 | 0, AC_VERB_SET_CONNECT_SEL, |
| 11312 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11313 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11314 | |
| 11315 | spec->vmaster_nid = 0x02; |
| 11316 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11317 | codec->patch_ops = alc_patch_ops; |
| 11318 | if (board_config == ALC268_AUTO) |
| 11319 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11320 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11321 | return 0; |
| 11322 | } |
| 11323 | |
| 11324 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11325 | * ALC269 channel source setting (2 channel) |
| 11326 | */ |
| 11327 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 11328 | |
| 11329 | #define alc269_dac_nids alc260_dac_nids |
| 11330 | |
| 11331 | static hda_nid_t alc269_adc_nids[1] = { |
| 11332 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11333 | 0x08, |
| 11334 | }; |
| 11335 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 11336 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 11337 | 0x23, |
| 11338 | }; |
| 11339 | |
| 11340 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 11341 | * not a mux! |
| 11342 | */ |
| 11343 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11344 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 11345 | .num_items = 2, |
| 11346 | .items = { |
| 11347 | { "i-Mic", 0x5 }, |
| 11348 | { "e-Mic", 0x0 }, |
| 11349 | }, |
| 11350 | }; |
| 11351 | |
| 11352 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 11353 | .num_items = 2, |
| 11354 | .items = { |
| 11355 | { "i-Mic", 0x1 }, |
| 11356 | { "e-Mic", 0x0 }, |
| 11357 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11358 | }; |
| 11359 | |
| 11360 | #define alc269_modes alc260_modes |
| 11361 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 11362 | |
| 11363 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 11364 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11365 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11366 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11367 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11368 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11369 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11370 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11371 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11372 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11373 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11374 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11375 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11376 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11377 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 11378 | { } /* end */ |
| 11379 | }; |
| 11380 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11381 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 11382 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 11383 | .ops = &snd_hda_bind_vol, |
| 11384 | .values = { |
| 11385 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11386 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11387 | 0 |
| 11388 | }, |
| 11389 | }; |
| 11390 | |
| 11391 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 11392 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11393 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 11394 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11395 | { } /* end */ |
| 11396 | }; |
| 11397 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11398 | /* capture mixer elements */ |
| 11399 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11400 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11401 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11402 | { |
| 11403 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11404 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11405 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11406 | */ |
| 11407 | /* .name = "Capture Source", */ |
| 11408 | .name = "Input Source", |
| 11409 | .count = 1, |
| 11410 | .info = alc_mux_enum_info, |
| 11411 | .get = alc_mux_enum_get, |
| 11412 | .put = alc_mux_enum_put, |
| 11413 | }, |
| 11414 | { } /* end */ |
| 11415 | }; |
| 11416 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11417 | /* capture mixer elements */ |
| 11418 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 11419 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11420 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11421 | { } /* end */ |
| 11422 | }; |
| 11423 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11424 | /* beep control */ |
| 11425 | static struct snd_kcontrol_new alc269_beep_mixer[] = { |
| 11426 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11427 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
| 11428 | { } /* end */ |
| 11429 | }; |
| 11430 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11431 | /* |
| 11432 | * generic initialization of ADC, input mixers and output mixers |
| 11433 | */ |
| 11434 | static struct hda_verb alc269_init_verbs[] = { |
| 11435 | /* |
| 11436 | * Unmute ADC0 and set the default input to mic-in |
| 11437 | */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11438 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11439 | |
| 11440 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 11441 | * analog-loopback mixer widget |
| 11442 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11443 | * front panel mic (mic 2) |
| 11444 | */ |
| 11445 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 11446 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11447 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11448 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11449 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11450 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11451 | |
| 11452 | /* |
| 11453 | * Set up output mixers (0x0c - 0x0e) |
| 11454 | */ |
| 11455 | /* set vol=0 to output mixers */ |
| 11456 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11457 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11458 | |
| 11459 | /* set up input amps for analog loopback */ |
| 11460 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11461 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11463 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11464 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11465 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11466 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11467 | |
| 11468 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11469 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11470 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11471 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11472 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11473 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11474 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11475 | |
| 11476 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11477 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11478 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11479 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11480 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11481 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11482 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11483 | |
| 11484 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11485 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11486 | |
| 11487 | /* FIXME: use matrix-type input source selection */ |
| 11488 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 11489 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11490 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11491 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11492 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11493 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11494 | |
| 11495 | /* set EAPD */ |
| 11496 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11497 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11498 | { } |
| 11499 | }; |
| 11500 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11501 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 11502 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11503 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 11504 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11505 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 11506 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11507 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11508 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11509 | {} |
| 11510 | }; |
| 11511 | |
| 11512 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 11513 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11514 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11515 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11516 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 11517 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11518 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11519 | {} |
| 11520 | }; |
| 11521 | |
| 11522 | /* toggle speaker-output according to the hp-jack state */ |
| 11523 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 11524 | { |
| 11525 | unsigned int present; |
| 11526 | unsigned int bits; |
| 11527 | |
| 11528 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11529 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11530 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11531 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11532 | AMP_IN_MUTE(0), bits); |
| 11533 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11534 | AMP_IN_MUTE(0), bits); |
| 11535 | } |
| 11536 | |
| 11537 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 11538 | { |
| 11539 | unsigned int present; |
| 11540 | |
| 11541 | present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11542 | & AC_PINSENSE_PRESENCE; |
| 11543 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11544 | present ? 0 : 5); |
| 11545 | } |
| 11546 | |
| 11547 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 11548 | { |
| 11549 | unsigned int present; |
| 11550 | |
| 11551 | present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11552 | & AC_PINSENSE_PRESENCE; |
| 11553 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11554 | present ? AMP_IN_UNMUTE(0) : AMP_IN_MUTE(0)); |
| 11555 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11556 | present ? AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1)); |
| 11557 | } |
| 11558 | |
| 11559 | /* unsolicited event for HP jack sensing */ |
| 11560 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 11561 | unsigned int res) |
| 11562 | { |
| 11563 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11564 | alc269_speaker_automute(codec); |
| 11565 | |
| 11566 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11567 | alc269_eeepc_dmic_automute(codec); |
| 11568 | } |
| 11569 | |
| 11570 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 11571 | { |
| 11572 | alc269_speaker_automute(codec); |
| 11573 | alc269_eeepc_dmic_automute(codec); |
| 11574 | } |
| 11575 | |
| 11576 | /* unsolicited event for HP jack sensing */ |
| 11577 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11578 | unsigned int res) |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11579 | { |
| 11580 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11581 | alc269_speaker_automute(codec); |
| 11582 | |
| 11583 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11584 | alc269_eeepc_amic_automute(codec); |
| 11585 | } |
| 11586 | |
| 11587 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 11588 | { |
| 11589 | alc269_speaker_automute(codec); |
| 11590 | alc269_eeepc_amic_automute(codec); |
| 11591 | } |
| 11592 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11593 | /* add playback controls from the parsed DAC table */ |
| 11594 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11595 | const struct auto_pin_cfg *cfg) |
| 11596 | { |
| 11597 | hda_nid_t nid; |
| 11598 | int err; |
| 11599 | |
| 11600 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11601 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11602 | spec->multiout.dac_nids[0] = 2; |
| 11603 | |
| 11604 | nid = cfg->line_out_pins[0]; |
| 11605 | if (nid) { |
| 11606 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11607 | "Front Playback Volume", |
| 11608 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 11609 | if (err < 0) |
| 11610 | return err; |
| 11611 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11612 | "Front Playback Switch", |
| 11613 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11614 | if (err < 0) |
| 11615 | return err; |
| 11616 | } |
| 11617 | |
| 11618 | nid = cfg->speaker_pins[0]; |
| 11619 | if (nid) { |
| 11620 | if (!cfg->line_out_pins[0]) { |
| 11621 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11622 | "Speaker Playback Volume", |
| 11623 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 11624 | HDA_OUTPUT)); |
| 11625 | if (err < 0) |
| 11626 | return err; |
| 11627 | } |
| 11628 | if (nid == 0x16) { |
| 11629 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11630 | "Speaker Playback Switch", |
| 11631 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11632 | HDA_OUTPUT)); |
| 11633 | if (err < 0) |
| 11634 | return err; |
| 11635 | } else { |
| 11636 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11637 | "Speaker Playback Switch", |
| 11638 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11639 | HDA_OUTPUT)); |
| 11640 | if (err < 0) |
| 11641 | return err; |
| 11642 | } |
| 11643 | } |
| 11644 | nid = cfg->hp_pins[0]; |
| 11645 | if (nid) { |
| 11646 | /* spec->multiout.hp_nid = 2; */ |
| 11647 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 11648 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11649 | "Headphone Playback Volume", |
| 11650 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 11651 | HDA_OUTPUT)); |
| 11652 | if (err < 0) |
| 11653 | return err; |
| 11654 | } |
| 11655 | if (nid == 0x16) { |
| 11656 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11657 | "Headphone Playback Switch", |
| 11658 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11659 | HDA_OUTPUT)); |
| 11660 | if (err < 0) |
| 11661 | return err; |
| 11662 | } else { |
| 11663 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11664 | "Headphone Playback Switch", |
| 11665 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11666 | HDA_OUTPUT)); |
| 11667 | if (err < 0) |
| 11668 | return err; |
| 11669 | } |
| 11670 | } |
| 11671 | return 0; |
| 11672 | } |
| 11673 | |
| 11674 | #define alc269_auto_create_analog_input_ctls \ |
| 11675 | alc880_auto_create_analog_input_ctls |
| 11676 | |
| 11677 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11678 | #define alc269_loopbacks alc880_loopbacks |
| 11679 | #endif |
| 11680 | |
| 11681 | /* pcm configuration: identiacal with ALC880 */ |
| 11682 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 11683 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 11684 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 11685 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 11686 | |
| 11687 | /* |
| 11688 | * BIOS auto configuration |
| 11689 | */ |
| 11690 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 11691 | { |
| 11692 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11693 | int i, err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11694 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 11695 | |
| 11696 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11697 | alc269_ignore); |
| 11698 | if (err < 0) |
| 11699 | return err; |
| 11700 | |
| 11701 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11702 | if (err < 0) |
| 11703 | return err; |
| 11704 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11705 | if (err < 0) |
| 11706 | return err; |
| 11707 | |
| 11708 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11709 | |
| 11710 | if (spec->autocfg.dig_out_pin) |
| 11711 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 11712 | |
| 11713 | if (spec->kctl_alloc) |
| 11714 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11715 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11716 | /* create a beep mixer control if the pin 0x1d isn't assigned */ |
| 11717 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) |
| 11718 | if (spec->autocfg.input_pins[i] == 0x1d) |
| 11719 | break; |
| 11720 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) |
| 11721 | spec->mixers[spec->num_mixers++] = alc269_beep_mixer; |
| 11722 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11723 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 11724 | spec->num_mux_defs = 1; |
| 11725 | spec->input_mux = &spec->private_imux; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 11726 | /* set default input source */ |
| 11727 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 11728 | 0, AC_VERB_SET_CONNECT_SEL, |
| 11729 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11730 | |
| 11731 | err = alc_auto_add_mic_boost(codec); |
| 11732 | if (err < 0) |
| 11733 | return err; |
| 11734 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11735 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 11736 | spec->num_mixers++; |
| 11737 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11738 | return 1; |
| 11739 | } |
| 11740 | |
| 11741 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 11742 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 11743 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 11744 | |
| 11745 | |
| 11746 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11747 | static void alc269_auto_init(struct hda_codec *codec) |
| 11748 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11749 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11750 | alc269_auto_init_multi_out(codec); |
| 11751 | alc269_auto_init_hp_out(codec); |
| 11752 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11753 | if (spec->unsol_event) |
| 11754 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11755 | } |
| 11756 | |
| 11757 | /* |
| 11758 | * configuration and preset |
| 11759 | */ |
| 11760 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 11761 | [ALC269_BASIC] = "basic", |
| 11762 | }; |
| 11763 | |
| 11764 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11765 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 11766 | ALC269_ASUS_EEEPC_P703), |
| 11767 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 11768 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11769 | {} |
| 11770 | }; |
| 11771 | |
| 11772 | static struct alc_config_preset alc269_presets[] = { |
| 11773 | [ALC269_BASIC] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11774 | .mixers = { alc269_base_mixer, alc269_capture_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11775 | .init_verbs = { alc269_init_verbs }, |
| 11776 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11777 | .dac_nids = alc269_dac_nids, |
| 11778 | .hp_nid = 0x03, |
| 11779 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11780 | .channel_mode = alc269_modes, |
| 11781 | .input_mux = &alc269_capture_source, |
| 11782 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11783 | [ALC269_ASUS_EEEPC_P703] = { |
| 11784 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, |
| 11785 | .init_verbs = { alc269_init_verbs, |
| 11786 | alc269_eeepc_amic_init_verbs }, |
| 11787 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11788 | .dac_nids = alc269_dac_nids, |
| 11789 | .hp_nid = 0x03, |
| 11790 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11791 | .channel_mode = alc269_modes, |
| 11792 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 11793 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 11794 | .init_hook = alc269_eeepc_amic_inithook, |
| 11795 | }, |
| 11796 | [ALC269_ASUS_EEEPC_P901] = { |
| 11797 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer}, |
| 11798 | .init_verbs = { alc269_init_verbs, |
| 11799 | alc269_eeepc_dmic_init_verbs }, |
| 11800 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11801 | .dac_nids = alc269_dac_nids, |
| 11802 | .hp_nid = 0x03, |
| 11803 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11804 | .channel_mode = alc269_modes, |
| 11805 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 11806 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 11807 | .init_hook = alc269_eeepc_dmic_inithook, |
| 11808 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11809 | }; |
| 11810 | |
| 11811 | static int patch_alc269(struct hda_codec *codec) |
| 11812 | { |
| 11813 | struct alc_spec *spec; |
| 11814 | int board_config; |
| 11815 | int err; |
| 11816 | |
| 11817 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11818 | if (spec == NULL) |
| 11819 | return -ENOMEM; |
| 11820 | |
| 11821 | codec->spec = spec; |
| 11822 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11823 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 11824 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11825 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 11826 | alc269_models, |
| 11827 | alc269_cfg_tbl); |
| 11828 | |
| 11829 | if (board_config < 0) { |
| 11830 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 11831 | "trying auto-probe from BIOS...\n"); |
| 11832 | board_config = ALC269_AUTO; |
| 11833 | } |
| 11834 | |
| 11835 | if (board_config == ALC269_AUTO) { |
| 11836 | /* automatic parse from the BIOS config */ |
| 11837 | err = alc269_parse_auto_config(codec); |
| 11838 | if (err < 0) { |
| 11839 | alc_free(codec); |
| 11840 | return err; |
| 11841 | } else if (!err) { |
| 11842 | printk(KERN_INFO |
| 11843 | "hda_codec: Cannot set up configuration " |
| 11844 | "from BIOS. Using base mode...\n"); |
| 11845 | board_config = ALC269_BASIC; |
| 11846 | } |
| 11847 | } |
| 11848 | |
| 11849 | if (board_config != ALC269_AUTO) |
| 11850 | setup_preset(spec, &alc269_presets[board_config]); |
| 11851 | |
| 11852 | spec->stream_name_analog = "ALC269 Analog"; |
| 11853 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 11854 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 11855 | |
| 11856 | spec->stream_name_digital = "ALC269 Digital"; |
| 11857 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 11858 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 11859 | |
| 11860 | spec->adc_nids = alc269_adc_nids; |
| 11861 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 11862 | spec->capsrc_nids = alc269_capsrc_nids; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11863 | |
| 11864 | codec->patch_ops = alc_patch_ops; |
| 11865 | if (board_config == ALC269_AUTO) |
| 11866 | spec->init_hook = alc269_auto_init; |
| 11867 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11868 | if (!spec->loopback.amplist) |
| 11869 | spec->loopback.amplist = alc269_loopbacks; |
| 11870 | #endif |
| 11871 | |
| 11872 | return 0; |
| 11873 | } |
| 11874 | |
| 11875 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11876 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 11877 | */ |
| 11878 | |
| 11879 | /* |
| 11880 | * set the path ways for 2 channel output |
| 11881 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 11882 | */ |
| 11883 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 11884 | /* set pin widget 1Ah (line in) for input */ |
| 11885 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11886 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11887 | * the vref |
| 11888 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11889 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11890 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11891 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11892 | #if 0 |
| 11893 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11894 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11895 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11896 | { } /* end */ |
| 11897 | }; |
| 11898 | /* |
| 11899 | * 6ch mode |
| 11900 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 11901 | */ |
| 11902 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 11903 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11904 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11905 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11906 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11907 | |
| 11908 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11909 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11910 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11911 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11912 | #if 0 |
| 11913 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11914 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11915 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11916 | { } /* end */ |
| 11917 | }; |
| 11918 | |
| 11919 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 11920 | { 2, alc861_threestack_ch2_init }, |
| 11921 | { 6, alc861_threestack_ch6_init }, |
| 11922 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11923 | /* Set mic1 as input and unmute the mixer */ |
| 11924 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 11925 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11926 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11927 | { } /* end */ |
| 11928 | }; |
| 11929 | /* Set mic1 as output and mute mixer */ |
| 11930 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 11931 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11932 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11933 | { } /* end */ |
| 11934 | }; |
| 11935 | |
| 11936 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 11937 | { 2, alc861_uniwill_m31_ch2_init }, |
| 11938 | { 4, alc861_uniwill_m31_ch4_init }, |
| 11939 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11940 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11941 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 11942 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 11943 | /* set pin widget 1Ah (line in) for input */ |
| 11944 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11945 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11946 | * the vref |
| 11947 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11948 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11949 | |
| 11950 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11951 | #if 0 |
| 11952 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11953 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11954 | #endif |
| 11955 | { } /* end */ |
| 11956 | }; |
| 11957 | /* Set mic1 nad line-in as output and mute mixer */ |
| 11958 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 11959 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11960 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11961 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11962 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11963 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11964 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11965 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11966 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11967 | |
| 11968 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11969 | #if 0 |
| 11970 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11971 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11972 | #endif |
| 11973 | { } /* end */ |
| 11974 | }; |
| 11975 | |
| 11976 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 11977 | { 2, alc861_asus_ch2_init }, |
| 11978 | { 6, alc861_asus_ch6_init }, |
| 11979 | }; |
| 11980 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11981 | /* patch-ALC861 */ |
| 11982 | |
| 11983 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 11984 | /* output mixer control */ |
| 11985 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11986 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11987 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11988 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11989 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11990 | |
| 11991 | /*Input mixer control */ |
| 11992 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11993 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11994 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11995 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11996 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11997 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11998 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11999 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12000 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12001 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12002 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12003 | /* Capture mixer control */ |
| 12004 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12005 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12006 | { |
| 12007 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12008 | .name = "Capture Source", |
| 12009 | .count = 1, |
| 12010 | .info = alc_mux_enum_info, |
| 12011 | .get = alc_mux_enum_get, |
| 12012 | .put = alc_mux_enum_put, |
| 12013 | }, |
| 12014 | { } /* end */ |
| 12015 | }; |
| 12016 | |
| 12017 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 12018 | /* output mixer control */ |
| 12019 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12020 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12021 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12022 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12023 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12024 | |
| 12025 | /* Input mixer control */ |
| 12026 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12027 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12028 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12029 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12030 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12031 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12032 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12033 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12034 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12035 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12036 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12037 | /* Capture mixer control */ |
| 12038 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12039 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12040 | { |
| 12041 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12042 | .name = "Capture Source", |
| 12043 | .count = 1, |
| 12044 | .info = alc_mux_enum_info, |
| 12045 | .get = alc_mux_enum_get, |
| 12046 | .put = alc_mux_enum_put, |
| 12047 | }, |
| 12048 | { |
| 12049 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12050 | .name = "Channel Mode", |
| 12051 | .info = alc_ch_mode_info, |
| 12052 | .get = alc_ch_mode_get, |
| 12053 | .put = alc_ch_mode_put, |
| 12054 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 12055 | }, |
| 12056 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12057 | }; |
| 12058 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12059 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12060 | /* output mixer control */ |
| 12061 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12064 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12065 | /*Capture mixer control */ |
| 12066 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12067 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12068 | { |
| 12069 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12070 | .name = "Capture Source", |
| 12071 | .count = 1, |
| 12072 | .info = alc_mux_enum_info, |
| 12073 | .get = alc_mux_enum_get, |
| 12074 | .put = alc_mux_enum_put, |
| 12075 | }, |
| 12076 | |
| 12077 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12078 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12079 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12080 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 12081 | /* output mixer control */ |
| 12082 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12083 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12084 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12085 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12086 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12087 | |
| 12088 | /* Input mixer control */ |
| 12089 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12090 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12091 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12092 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12093 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12094 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12095 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12096 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12097 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12098 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12099 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12100 | /* Capture mixer control */ |
| 12101 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12102 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12103 | { |
| 12104 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12105 | .name = "Capture Source", |
| 12106 | .count = 1, |
| 12107 | .info = alc_mux_enum_info, |
| 12108 | .get = alc_mux_enum_get, |
| 12109 | .put = alc_mux_enum_put, |
| 12110 | }, |
| 12111 | { |
| 12112 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12113 | .name = "Channel Mode", |
| 12114 | .info = alc_ch_mode_info, |
| 12115 | .get = alc_ch_mode_get, |
| 12116 | .put = alc_ch_mode_put, |
| 12117 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12118 | }, |
| 12119 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12120 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12121 | |
| 12122 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 12123 | /* output mixer control */ |
| 12124 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12125 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12126 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12127 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12128 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12129 | |
| 12130 | /* Input mixer control */ |
| 12131 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12132 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12133 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12134 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12135 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12136 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12137 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12138 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12139 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12140 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 12141 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12142 | /* Capture mixer control */ |
| 12143 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12144 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12145 | { |
| 12146 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12147 | .name = "Capture Source", |
| 12148 | .count = 1, |
| 12149 | .info = alc_mux_enum_info, |
| 12150 | .get = alc_mux_enum_get, |
| 12151 | .put = alc_mux_enum_put, |
| 12152 | }, |
| 12153 | { |
| 12154 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12155 | .name = "Channel Mode", |
| 12156 | .info = alc_ch_mode_info, |
| 12157 | .get = alc_ch_mode_get, |
| 12158 | .put = alc_ch_mode_put, |
| 12159 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 12160 | }, |
| 12161 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12162 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12163 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12164 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12165 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12166 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12167 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12168 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12169 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12170 | { } |
| 12171 | }; |
| 12172 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12173 | /* |
| 12174 | * generic initialization of ADC, input mixers and output mixers |
| 12175 | */ |
| 12176 | static struct hda_verb alc861_base_init_verbs[] = { |
| 12177 | /* |
| 12178 | * Unmute ADC0 and set the default input to mic-in |
| 12179 | */ |
| 12180 | /* port-A for surround (rear panel) */ |
| 12181 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12182 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12183 | /* port-B for mic-in (rear panel) with vref */ |
| 12184 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12185 | /* port-C for line-in (rear panel) */ |
| 12186 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12187 | /* port-D for Front */ |
| 12188 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12189 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12190 | /* port-E for HP out (front panel) */ |
| 12191 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12192 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12193 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12194 | /* port-F for mic-in (front panel) with vref */ |
| 12195 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12196 | /* port-G for CLFE (rear panel) */ |
| 12197 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12198 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12199 | /* port-H for side (rear panel) */ |
| 12200 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12201 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12202 | /* CD-in */ |
| 12203 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12204 | /* route front mic to ADC1*/ |
| 12205 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12206 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12207 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12208 | /* Unmute DAC0~3 & spdif out*/ |
| 12209 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12210 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12211 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12212 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12213 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12214 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12215 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12216 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12217 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12218 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12219 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12220 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12221 | /* Unmute Stereo Mixer 15 */ |
| 12222 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12223 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12224 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12225 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12226 | |
| 12227 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12228 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12229 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12230 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12231 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12232 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12233 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12234 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12235 | /* hp used DAC 3 (Front) */ |
| 12236 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12237 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12238 | |
| 12239 | { } |
| 12240 | }; |
| 12241 | |
| 12242 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 12243 | /* |
| 12244 | * Unmute ADC0 and set the default input to mic-in |
| 12245 | */ |
| 12246 | /* port-A for surround (rear panel) */ |
| 12247 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12248 | /* port-B for mic-in (rear panel) with vref */ |
| 12249 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12250 | /* port-C for line-in (rear panel) */ |
| 12251 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12252 | /* port-D for Front */ |
| 12253 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12254 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12255 | /* port-E for HP out (front panel) */ |
| 12256 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12257 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12258 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12259 | /* port-F for mic-in (front panel) with vref */ |
| 12260 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12261 | /* port-G for CLFE (rear panel) */ |
| 12262 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12263 | /* port-H for side (rear panel) */ |
| 12264 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12265 | /* CD-in */ |
| 12266 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12267 | /* route front mic to ADC1*/ |
| 12268 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12269 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12270 | /* Unmute DAC0~3 & spdif out*/ |
| 12271 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12272 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12273 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12274 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12275 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12276 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12277 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12278 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12279 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12280 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12281 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12282 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12283 | /* Unmute Stereo Mixer 15 */ |
| 12284 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12285 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12286 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12287 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12288 | |
| 12289 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12290 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12291 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12292 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12293 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12294 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12295 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12296 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12297 | /* hp used DAC 3 (Front) */ |
| 12298 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12299 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12300 | { } |
| 12301 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12302 | |
| 12303 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 12304 | /* |
| 12305 | * Unmute ADC0 and set the default input to mic-in |
| 12306 | */ |
| 12307 | /* port-A for surround (rear panel) */ |
| 12308 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12309 | /* port-B for mic-in (rear panel) with vref */ |
| 12310 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12311 | /* port-C for line-in (rear panel) */ |
| 12312 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12313 | /* port-D for Front */ |
| 12314 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12315 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12316 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12317 | /* this has to be set to VREF80 */ |
| 12318 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12319 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12320 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12321 | /* port-F for mic-in (front panel) with vref */ |
| 12322 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12323 | /* port-G for CLFE (rear panel) */ |
| 12324 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12325 | /* port-H for side (rear panel) */ |
| 12326 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12327 | /* CD-in */ |
| 12328 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12329 | /* route front mic to ADC1*/ |
| 12330 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12331 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12332 | /* Unmute DAC0~3 & spdif out*/ |
| 12333 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12334 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12335 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12336 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12337 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12338 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12339 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12340 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12341 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12342 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12343 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12344 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12345 | /* Unmute Stereo Mixer 15 */ |
| 12346 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12347 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12348 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12349 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12350 | |
| 12351 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12352 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12353 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12354 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12355 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12356 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12357 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12358 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12359 | /* hp used DAC 3 (Front) */ |
| 12360 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12361 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12362 | { } |
| 12363 | }; |
| 12364 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12365 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 12366 | /* |
| 12367 | * Unmute ADC0 and set the default input to mic-in |
| 12368 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12369 | /* port-A for surround (rear panel) |
| 12370 | * according to codec#0 this is the HP jack |
| 12371 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12372 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 12373 | /* route front PCM to HP */ |
| 12374 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12375 | /* port-B for mic-in (rear panel) with vref */ |
| 12376 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12377 | /* port-C for line-in (rear panel) */ |
| 12378 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12379 | /* port-D for Front */ |
| 12380 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12381 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12382 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12383 | /* this has to be set to VREF80 */ |
| 12384 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12385 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12386 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12387 | /* port-F for mic-in (front panel) with vref */ |
| 12388 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12389 | /* port-G for CLFE (rear panel) */ |
| 12390 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12391 | /* port-H for side (rear panel) */ |
| 12392 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12393 | /* CD-in */ |
| 12394 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12395 | /* route front mic to ADC1*/ |
| 12396 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12397 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12398 | /* Unmute DAC0~3 & spdif out*/ |
| 12399 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12400 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12401 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12402 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12403 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12404 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12405 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12406 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12407 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12408 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12409 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12410 | /* Unmute Stereo Mixer 15 */ |
| 12411 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12412 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12413 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12414 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12415 | |
| 12416 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12417 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12418 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12419 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12420 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12421 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12422 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12423 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12424 | /* hp used DAC 3 (Front) */ |
| 12425 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12426 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12427 | { } |
| 12428 | }; |
| 12429 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12430 | /* additional init verbs for ASUS laptops */ |
| 12431 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 12432 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 12433 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 12434 | { } |
| 12435 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12436 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12437 | /* |
| 12438 | * generic initialization of ADC, input mixers and output mixers |
| 12439 | */ |
| 12440 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 12441 | /* |
| 12442 | * Unmute ADC0 and set the default input to mic-in |
| 12443 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12444 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12445 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12446 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12447 | /* Unmute DAC0~3 & spdif out*/ |
| 12448 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12449 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12450 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12451 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12452 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12453 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12454 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12455 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12456 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12457 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12458 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12459 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12460 | /* Unmute Stereo Mixer 15 */ |
| 12461 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12462 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12463 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12464 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 12465 | |
| 12466 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12467 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12468 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12469 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12470 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12471 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12472 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12473 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12474 | |
| 12475 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12476 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12477 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12478 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12479 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12480 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12481 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12482 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12483 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12484 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12485 | |
| 12486 | { } |
| 12487 | }; |
| 12488 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12489 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 12490 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12491 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12492 | { } |
| 12493 | }; |
| 12494 | |
| 12495 | /* toggle speaker-output according to the hp-jack state */ |
| 12496 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 12497 | { |
| 12498 | unsigned int present; |
| 12499 | |
| 12500 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 12501 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12502 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 12503 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 12504 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 12505 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12506 | } |
| 12507 | |
| 12508 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 12509 | unsigned int res) |
| 12510 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12511 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12512 | alc861_toshiba_automute(codec); |
| 12513 | } |
| 12514 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12515 | /* pcm configuration: identiacal with ALC880 */ |
| 12516 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 12517 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 12518 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 12519 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 12520 | |
| 12521 | |
| 12522 | #define ALC861_DIGOUT_NID 0x07 |
| 12523 | |
| 12524 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 12525 | { 8, NULL } |
| 12526 | }; |
| 12527 | |
| 12528 | static hda_nid_t alc861_dac_nids[4] = { |
| 12529 | /* front, surround, clfe, side */ |
| 12530 | 0x03, 0x06, 0x05, 0x04 |
| 12531 | }; |
| 12532 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12533 | static hda_nid_t alc660_dac_nids[3] = { |
| 12534 | /* front, clfe, surround */ |
| 12535 | 0x03, 0x05, 0x06 |
| 12536 | }; |
| 12537 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12538 | static hda_nid_t alc861_adc_nids[1] = { |
| 12539 | /* ADC0-2 */ |
| 12540 | 0x08, |
| 12541 | }; |
| 12542 | |
| 12543 | static struct hda_input_mux alc861_capture_source = { |
| 12544 | .num_items = 5, |
| 12545 | .items = { |
| 12546 | { "Mic", 0x0 }, |
| 12547 | { "Front Mic", 0x3 }, |
| 12548 | { "Line", 0x1 }, |
| 12549 | { "CD", 0x4 }, |
| 12550 | { "Mixer", 0x5 }, |
| 12551 | }, |
| 12552 | }; |
| 12553 | |
| 12554 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12555 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 12556 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12557 | { |
| 12558 | int i; |
| 12559 | hda_nid_t nid; |
| 12560 | |
| 12561 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12562 | for (i = 0; i < cfg->line_outs; i++) { |
| 12563 | nid = cfg->line_out_pins[i]; |
| 12564 | if (nid) { |
| 12565 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 12566 | continue; |
| 12567 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 12568 | } |
| 12569 | } |
| 12570 | spec->multiout.num_dacs = cfg->line_outs; |
| 12571 | return 0; |
| 12572 | } |
| 12573 | |
| 12574 | /* add playback controls from the parsed DAC table */ |
| 12575 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12576 | const struct auto_pin_cfg *cfg) |
| 12577 | { |
| 12578 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12579 | static const char *chname[4] = { |
| 12580 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 12581 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12582 | hda_nid_t nid; |
| 12583 | int i, idx, err; |
| 12584 | |
| 12585 | for (i = 0; i < cfg->line_outs; i++) { |
| 12586 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12587 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12588 | continue; |
| 12589 | if (nid == 0x05) { |
| 12590 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12591 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12592 | "Center Playback Switch", |
| 12593 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 12594 | HDA_OUTPUT)); |
| 12595 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12596 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12597 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12598 | "LFE Playback Switch", |
| 12599 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12600 | HDA_OUTPUT)); |
| 12601 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12602 | return err; |
| 12603 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12604 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 12605 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12606 | if (nid == alc861_dac_nids[idx]) |
| 12607 | break; |
| 12608 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12609 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12610 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12611 | HDA_OUTPUT)); |
| 12612 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12613 | return err; |
| 12614 | } |
| 12615 | } |
| 12616 | return 0; |
| 12617 | } |
| 12618 | |
| 12619 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 12620 | { |
| 12621 | int err; |
| 12622 | hda_nid_t nid; |
| 12623 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12624 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12625 | return 0; |
| 12626 | |
| 12627 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 12628 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12629 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12630 | "Headphone Playback Switch", |
| 12631 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12632 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12633 | return err; |
| 12634 | spec->multiout.hp_nid = nid; |
| 12635 | } |
| 12636 | return 0; |
| 12637 | } |
| 12638 | |
| 12639 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12640 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12641 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12642 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12643 | struct hda_input_mux *imux = &spec->private_imux; |
| 12644 | int i, err, idx, idx1; |
| 12645 | |
| 12646 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12647 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12648 | case 0x0c: |
| 12649 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12650 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12651 | break; |
| 12652 | case 0x0f: |
| 12653 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12654 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12655 | break; |
| 12656 | case 0x0d: |
| 12657 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12658 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12659 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12660 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12661 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12662 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12663 | break; |
| 12664 | case 0x11: |
| 12665 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12666 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12667 | break; |
| 12668 | default: |
| 12669 | continue; |
| 12670 | } |
| 12671 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 12672 | err = new_analog_input(spec, cfg->input_pins[i], |
| 12673 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12674 | if (err < 0) |
| 12675 | return err; |
| 12676 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 12677 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12678 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12679 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12680 | } |
| 12681 | return 0; |
| 12682 | } |
| 12683 | |
| 12684 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 12685 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12686 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12687 | |
| 12688 | { |
| 12689 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12690 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12691 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12692 | */ |
| 12693 | /* .name = "Capture Source", */ |
| 12694 | .name = "Input Source", |
| 12695 | .count = 1, |
| 12696 | .info = alc_mux_enum_info, |
| 12697 | .get = alc_mux_enum_get, |
| 12698 | .put = alc_mux_enum_put, |
| 12699 | }, |
| 12700 | { } /* end */ |
| 12701 | }; |
| 12702 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12703 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12704 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12705 | int pin_type, int dac_idx) |
| 12706 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 12707 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12708 | pin_type); |
| 12709 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12710 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12711 | } |
| 12712 | |
| 12713 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 12714 | { |
| 12715 | struct alc_spec *spec = codec->spec; |
| 12716 | int i; |
| 12717 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12718 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12719 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 12720 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12721 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12722 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12723 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12724 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12725 | } |
| 12726 | } |
| 12727 | |
| 12728 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 12729 | { |
| 12730 | struct alc_spec *spec = codec->spec; |
| 12731 | hda_nid_t pin; |
| 12732 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 12733 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12734 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12735 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 12736 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12737 | pin = spec->autocfg.speaker_pins[0]; |
| 12738 | if (pin) |
| 12739 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12740 | } |
| 12741 | |
| 12742 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 12743 | { |
| 12744 | struct alc_spec *spec = codec->spec; |
| 12745 | int i; |
| 12746 | |
| 12747 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12748 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12749 | if (nid >= 0x0c && nid <= 0x11) { |
| 12750 | snd_hda_codec_write(codec, nid, 0, |
| 12751 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12752 | i <= AUTO_PIN_FRONT_MIC ? |
| 12753 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12754 | } |
| 12755 | } |
| 12756 | } |
| 12757 | |
| 12758 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12759 | /* return 1 if successful, 0 if the proper config is not found, |
| 12760 | * or a negative error code |
| 12761 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12762 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 12763 | { |
| 12764 | struct alc_spec *spec = codec->spec; |
| 12765 | int err; |
| 12766 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 12767 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12768 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12769 | alc861_ignore); |
| 12770 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12771 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12772 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12773 | return 0; /* can't find valid BIOS pin config */ |
| 12774 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12775 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12776 | if (err < 0) |
| 12777 | return err; |
| 12778 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12779 | if (err < 0) |
| 12780 | return err; |
| 12781 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 12782 | if (err < 0) |
| 12783 | return err; |
| 12784 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12785 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12786 | return err; |
| 12787 | |
| 12788 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12789 | |
| 12790 | if (spec->autocfg.dig_out_pin) |
| 12791 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 12792 | |
| 12793 | if (spec->kctl_alloc) |
| 12794 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12795 | |
| 12796 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 12797 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12798 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12799 | spec->input_mux = &spec->private_imux; |
| 12800 | |
| 12801 | spec->adc_nids = alc861_adc_nids; |
| 12802 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 12803 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 12804 | spec->num_mixers++; |
| 12805 | |
| 12806 | return 1; |
| 12807 | } |
| 12808 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12809 | /* additional initialization for auto-configuration model */ |
| 12810 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12811 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12812 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12813 | alc861_auto_init_multi_out(codec); |
| 12814 | alc861_auto_init_hp_out(codec); |
| 12815 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12816 | if (spec->unsol_event) |
| 12817 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12818 | } |
| 12819 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12820 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12821 | static struct hda_amp_list alc861_loopbacks[] = { |
| 12822 | { 0x15, HDA_INPUT, 0 }, |
| 12823 | { 0x15, HDA_INPUT, 1 }, |
| 12824 | { 0x15, HDA_INPUT, 2 }, |
| 12825 | { 0x15, HDA_INPUT, 3 }, |
| 12826 | { } /* end */ |
| 12827 | }; |
| 12828 | #endif |
| 12829 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12830 | |
| 12831 | /* |
| 12832 | * configuration and preset |
| 12833 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12834 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 12835 | [ALC861_3ST] = "3stack", |
| 12836 | [ALC660_3ST] = "3stack-660", |
| 12837 | [ALC861_3ST_DIG] = "3stack-dig", |
| 12838 | [ALC861_6ST_DIG] = "6stack-dig", |
| 12839 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 12840 | [ALC861_TOSHIBA] = "toshiba", |
| 12841 | [ALC861_ASUS] = "asus", |
| 12842 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 12843 | [ALC861_AUTO] = "auto", |
| 12844 | }; |
| 12845 | |
| 12846 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 12847 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12848 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12849 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12850 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12851 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12852 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 12853 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 12854 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 12855 | * Any other models that need this preset? |
| 12856 | */ |
| 12857 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 12858 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 12859 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12860 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 12861 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 12862 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 12863 | /* FIXME: the below seems conflict */ |
| 12864 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 12865 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 12866 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12867 | {} |
| 12868 | }; |
| 12869 | |
| 12870 | static struct alc_config_preset alc861_presets[] = { |
| 12871 | [ALC861_3ST] = { |
| 12872 | .mixers = { alc861_3ST_mixer }, |
| 12873 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12874 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12875 | .dac_nids = alc861_dac_nids, |
| 12876 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12877 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12878 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12879 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12880 | .adc_nids = alc861_adc_nids, |
| 12881 | .input_mux = &alc861_capture_source, |
| 12882 | }, |
| 12883 | [ALC861_3ST_DIG] = { |
| 12884 | .mixers = { alc861_base_mixer }, |
| 12885 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12886 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12887 | .dac_nids = alc861_dac_nids, |
| 12888 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12889 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12890 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12891 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12892 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12893 | .adc_nids = alc861_adc_nids, |
| 12894 | .input_mux = &alc861_capture_source, |
| 12895 | }, |
| 12896 | [ALC861_6ST_DIG] = { |
| 12897 | .mixers = { alc861_base_mixer }, |
| 12898 | .init_verbs = { alc861_base_init_verbs }, |
| 12899 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12900 | .dac_nids = alc861_dac_nids, |
| 12901 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12902 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 12903 | .channel_mode = alc861_8ch_modes, |
| 12904 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12905 | .adc_nids = alc861_adc_nids, |
| 12906 | .input_mux = &alc861_capture_source, |
| 12907 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12908 | [ALC660_3ST] = { |
| 12909 | .mixers = { alc861_3ST_mixer }, |
| 12910 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12911 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 12912 | .dac_nids = alc660_dac_nids, |
| 12913 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12914 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12915 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12916 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12917 | .adc_nids = alc861_adc_nids, |
| 12918 | .input_mux = &alc861_capture_source, |
| 12919 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12920 | [ALC861_UNIWILL_M31] = { |
| 12921 | .mixers = { alc861_uniwill_m31_mixer }, |
| 12922 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 12923 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12924 | .dac_nids = alc861_dac_nids, |
| 12925 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12926 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12927 | .channel_mode = alc861_uniwill_m31_modes, |
| 12928 | .need_dac_fix = 1, |
| 12929 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12930 | .adc_nids = alc861_adc_nids, |
| 12931 | .input_mux = &alc861_capture_source, |
| 12932 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12933 | [ALC861_TOSHIBA] = { |
| 12934 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12935 | .init_verbs = { alc861_base_init_verbs, |
| 12936 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12937 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12938 | .dac_nids = alc861_dac_nids, |
| 12939 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12940 | .channel_mode = alc883_3ST_2ch_modes, |
| 12941 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12942 | .adc_nids = alc861_adc_nids, |
| 12943 | .input_mux = &alc861_capture_source, |
| 12944 | .unsol_event = alc861_toshiba_unsol_event, |
| 12945 | .init_hook = alc861_toshiba_automute, |
| 12946 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12947 | [ALC861_ASUS] = { |
| 12948 | .mixers = { alc861_asus_mixer }, |
| 12949 | .init_verbs = { alc861_asus_init_verbs }, |
| 12950 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12951 | .dac_nids = alc861_dac_nids, |
| 12952 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12953 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 12954 | .channel_mode = alc861_asus_modes, |
| 12955 | .need_dac_fix = 1, |
| 12956 | .hp_nid = 0x06, |
| 12957 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12958 | .adc_nids = alc861_adc_nids, |
| 12959 | .input_mux = &alc861_capture_source, |
| 12960 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12961 | [ALC861_ASUS_LAPTOP] = { |
| 12962 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 12963 | .init_verbs = { alc861_asus_init_verbs, |
| 12964 | alc861_asus_laptop_init_verbs }, |
| 12965 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12966 | .dac_nids = alc861_dac_nids, |
| 12967 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12968 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12969 | .channel_mode = alc883_3ST_2ch_modes, |
| 12970 | .need_dac_fix = 1, |
| 12971 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12972 | .adc_nids = alc861_adc_nids, |
| 12973 | .input_mux = &alc861_capture_source, |
| 12974 | }, |
| 12975 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12976 | |
| 12977 | |
| 12978 | static int patch_alc861(struct hda_codec *codec) |
| 12979 | { |
| 12980 | struct alc_spec *spec; |
| 12981 | int board_config; |
| 12982 | int err; |
| 12983 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12984 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12985 | if (spec == NULL) |
| 12986 | return -ENOMEM; |
| 12987 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12988 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12989 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12990 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 12991 | alc861_models, |
| 12992 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12993 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12994 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12995 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 12996 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12997 | board_config = ALC861_AUTO; |
| 12998 | } |
| 12999 | |
| 13000 | if (board_config == ALC861_AUTO) { |
| 13001 | /* automatic parse from the BIOS config */ |
| 13002 | err = alc861_parse_auto_config(codec); |
| 13003 | if (err < 0) { |
| 13004 | alc_free(codec); |
| 13005 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13006 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13007 | printk(KERN_INFO |
| 13008 | "hda_codec: Cannot set up configuration " |
| 13009 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13010 | board_config = ALC861_3ST_DIG; |
| 13011 | } |
| 13012 | } |
| 13013 | |
| 13014 | if (board_config != ALC861_AUTO) |
| 13015 | setup_preset(spec, &alc861_presets[board_config]); |
| 13016 | |
| 13017 | spec->stream_name_analog = "ALC861 Analog"; |
| 13018 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 13019 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 13020 | |
| 13021 | spec->stream_name_digital = "ALC861 Digital"; |
| 13022 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 13023 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 13024 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13025 | spec->vmaster_nid = 0x03; |
| 13026 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13027 | codec->patch_ops = alc_patch_ops; |
| 13028 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13029 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13030 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13031 | if (!spec->loopback.amplist) |
| 13032 | spec->loopback.amplist = alc861_loopbacks; |
| 13033 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13034 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13035 | return 0; |
| 13036 | } |
| 13037 | |
| 13038 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13039 | * ALC861-VD support |
| 13040 | * |
| 13041 | * Based on ALC882 |
| 13042 | * |
| 13043 | * In addition, an independent DAC |
| 13044 | */ |
| 13045 | #define ALC861VD_DIGOUT_NID 0x06 |
| 13046 | |
| 13047 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 13048 | /* front, surr, clfe, side surr */ |
| 13049 | 0x02, 0x03, 0x04, 0x05 |
| 13050 | }; |
| 13051 | |
| 13052 | /* dac_nids for ALC660vd are in a different order - according to |
| 13053 | * Realtek's driver. |
| 13054 | * This should probably tesult in a different mixer for 6stack models |
| 13055 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 13056 | * - and it is the same as in 861vd. |
| 13057 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 13058 | */ |
| 13059 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 13060 | /* front, rear, clfe, rear_surr */ |
| 13061 | 0x02, 0x04, 0x03 |
| 13062 | }; |
| 13063 | |
| 13064 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 13065 | /* ADC0 */ |
| 13066 | 0x09, |
| 13067 | }; |
| 13068 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13069 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 13070 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13071 | /* input MUX */ |
| 13072 | /* FIXME: should be a matrix-type input source selection */ |
| 13073 | static struct hda_input_mux alc861vd_capture_source = { |
| 13074 | .num_items = 4, |
| 13075 | .items = { |
| 13076 | { "Mic", 0x0 }, |
| 13077 | { "Front Mic", 0x1 }, |
| 13078 | { "Line", 0x2 }, |
| 13079 | { "CD", 0x4 }, |
| 13080 | }, |
| 13081 | }; |
| 13082 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13083 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13084 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13085 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13086 | { "Ext Mic", 0x0 }, |
| 13087 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13088 | }, |
| 13089 | }; |
| 13090 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13091 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 13092 | .num_items = 2, |
| 13093 | .items = { |
| 13094 | { "Front Mic", 0x0 }, |
| 13095 | { "ATAPI Mic", 0x1 }, |
| 13096 | }, |
| 13097 | }; |
| 13098 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13099 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 13100 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13101 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 13102 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13103 | |
| 13104 | /* |
| 13105 | * 2ch mode |
| 13106 | */ |
| 13107 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 13108 | { 2, NULL } |
| 13109 | }; |
| 13110 | |
| 13111 | /* |
| 13112 | * 6ch mode |
| 13113 | */ |
| 13114 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 13115 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13116 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13117 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13118 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13119 | { } /* end */ |
| 13120 | }; |
| 13121 | |
| 13122 | /* |
| 13123 | * 8ch mode |
| 13124 | */ |
| 13125 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 13126 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13127 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13128 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13129 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13130 | { } /* end */ |
| 13131 | }; |
| 13132 | |
| 13133 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 13134 | { 6, alc861vd_6stack_ch6_init }, |
| 13135 | { 8, alc861vd_6stack_ch8_init }, |
| 13136 | }; |
| 13137 | |
| 13138 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 13139 | { |
| 13140 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13141 | .name = "Channel Mode", |
| 13142 | .info = alc_ch_mode_info, |
| 13143 | .get = alc_ch_mode_get, |
| 13144 | .put = alc_ch_mode_put, |
| 13145 | }, |
| 13146 | { } /* end */ |
| 13147 | }; |
| 13148 | |
| 13149 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 13150 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13151 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13152 | |
| 13153 | { |
| 13154 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13155 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13156 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13157 | */ |
| 13158 | /* .name = "Capture Source", */ |
| 13159 | .name = "Input Source", |
| 13160 | .count = 1, |
| 13161 | .info = alc861vd_mux_enum_info, |
| 13162 | .get = alc861vd_mux_enum_get, |
| 13163 | .put = alc861vd_mux_enum_put, |
| 13164 | }, |
| 13165 | { } /* end */ |
| 13166 | }; |
| 13167 | |
| 13168 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13169 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13170 | */ |
| 13171 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 13172 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13173 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13174 | |
| 13175 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13176 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13177 | |
| 13178 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 13179 | HDA_OUTPUT), |
| 13180 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 13181 | HDA_OUTPUT), |
| 13182 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13183 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 13184 | |
| 13185 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 13186 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13187 | |
| 13188 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13189 | |
| 13190 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13191 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13192 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13193 | |
| 13194 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13195 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13196 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13197 | |
| 13198 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13199 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13200 | |
| 13201 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13202 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13203 | |
| 13204 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13205 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13206 | |
| 13207 | { } /* end */ |
| 13208 | }; |
| 13209 | |
| 13210 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 13211 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13212 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13213 | |
| 13214 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13215 | |
| 13216 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13217 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13218 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13219 | |
| 13220 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13221 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13222 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13223 | |
| 13224 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13225 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13226 | |
| 13227 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13228 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13229 | |
| 13230 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13231 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13232 | |
| 13233 | { } /* end */ |
| 13234 | }; |
| 13235 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13236 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 13237 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13238 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 13239 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13240 | |
| 13241 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13242 | |
| 13243 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13244 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13245 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13246 | |
| 13247 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13248 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13249 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13250 | |
| 13251 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13252 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13253 | |
| 13254 | { } /* end */ |
| 13255 | }; |
| 13256 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13257 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 13258 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13259 | */ |
| 13260 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13261 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13262 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13263 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13264 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13265 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13266 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13267 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13268 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13269 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13270 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13271 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 13272 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13273 | { } /* end */ |
| 13274 | }; |
| 13275 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13276 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 13277 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 13278 | */ |
| 13279 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 13280 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13281 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13282 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13283 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13284 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13285 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13286 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13287 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13288 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13289 | { } /* end */ |
| 13290 | }; |
| 13291 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13292 | /* |
| 13293 | * generic initialization of ADC, input mixers and output mixers |
| 13294 | */ |
| 13295 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 13296 | /* |
| 13297 | * Unmute ADC0 and set the default input to mic-in |
| 13298 | */ |
| 13299 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13300 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13301 | |
| 13302 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 13303 | * the analog-loopback mixer widget |
| 13304 | */ |
| 13305 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13306 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13307 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13308 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13309 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13310 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13311 | |
| 13312 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13313 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13314 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13315 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13316 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13317 | |
| 13318 | /* |
| 13319 | * Set up output mixers (0x02 - 0x05) |
| 13320 | */ |
| 13321 | /* set vol=0 to output mixers */ |
| 13322 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13323 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13324 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13325 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13326 | |
| 13327 | /* set up input amps for analog loopback */ |
| 13328 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13329 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13330 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13331 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13332 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13333 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13334 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13335 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13336 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13337 | |
| 13338 | { } |
| 13339 | }; |
| 13340 | |
| 13341 | /* |
| 13342 | * 3-stack pin configuration: |
| 13343 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 13344 | */ |
| 13345 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 13346 | /* |
| 13347 | * Set pin mode and muting |
| 13348 | */ |
| 13349 | /* set front pin widgets 0x14 for output */ |
| 13350 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13351 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13352 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13353 | |
| 13354 | /* Mic (rear) pin: input vref at 80% */ |
| 13355 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13356 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13357 | /* Front Mic pin: input vref at 80% */ |
| 13358 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13359 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13360 | /* Line In pin: input */ |
| 13361 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13362 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13363 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13364 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13365 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13366 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13367 | /* CD pin widget for input */ |
| 13368 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13369 | |
| 13370 | { } |
| 13371 | }; |
| 13372 | |
| 13373 | /* |
| 13374 | * 6-stack pin configuration: |
| 13375 | */ |
| 13376 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 13377 | /* |
| 13378 | * Set pin mode and muting |
| 13379 | */ |
| 13380 | /* set front pin widgets 0x14 for output */ |
| 13381 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13382 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13383 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13384 | |
| 13385 | /* Rear Pin: output 1 (0x0d) */ |
| 13386 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13387 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13388 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13389 | /* CLFE Pin: output 2 (0x0e) */ |
| 13390 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13391 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13392 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 13393 | /* Side Pin: output 3 (0x0f) */ |
| 13394 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13395 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13396 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 13397 | |
| 13398 | /* Mic (rear) pin: input vref at 80% */ |
| 13399 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13400 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13401 | /* Front Mic pin: input vref at 80% */ |
| 13402 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13403 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13404 | /* Line In pin: input */ |
| 13405 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13406 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13407 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13408 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13409 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13410 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13411 | /* CD pin widget for input */ |
| 13412 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13413 | |
| 13414 | { } |
| 13415 | }; |
| 13416 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13417 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 13418 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13419 | { } |
| 13420 | }; |
| 13421 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 13422 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 13423 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13424 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13425 | { } |
| 13426 | }; |
| 13427 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13428 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 13429 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13431 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 13432 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13433 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13434 | {} |
| 13435 | }; |
| 13436 | |
| 13437 | /* toggle speaker-output according to the hp-jack state */ |
| 13438 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 13439 | { |
| 13440 | unsigned int present; |
| 13441 | unsigned char bits; |
| 13442 | |
| 13443 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13444 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13445 | bits = present ? HDA_AMP_MUTE : 0; |
| 13446 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13447 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13448 | } |
| 13449 | |
| 13450 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 13451 | { |
| 13452 | unsigned int present; |
| 13453 | unsigned char bits; |
| 13454 | |
| 13455 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13456 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13457 | bits = present ? HDA_AMP_MUTE : 0; |
| 13458 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 13459 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13460 | } |
| 13461 | |
| 13462 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 13463 | { |
| 13464 | alc861vd_lenovo_hp_automute(codec); |
| 13465 | alc861vd_lenovo_mic_automute(codec); |
| 13466 | } |
| 13467 | |
| 13468 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 13469 | unsigned int res) |
| 13470 | { |
| 13471 | switch (res >> 26) { |
| 13472 | case ALC880_HP_EVENT: |
| 13473 | alc861vd_lenovo_hp_automute(codec); |
| 13474 | break; |
| 13475 | case ALC880_MIC_EVENT: |
| 13476 | alc861vd_lenovo_mic_automute(codec); |
| 13477 | break; |
| 13478 | } |
| 13479 | } |
| 13480 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13481 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 13482 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13483 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13484 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13485 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13486 | |
| 13487 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13488 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13489 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13490 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13491 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13492 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13493 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13494 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13495 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13496 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13497 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13498 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13499 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13500 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13501 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13502 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13503 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13504 | |
| 13505 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13506 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13507 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13508 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13509 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13510 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13511 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13512 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13513 | |
| 13514 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13515 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13516 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13517 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13518 | |
| 13519 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13520 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13521 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13522 | |
| 13523 | { } /* end */ |
| 13524 | }; |
| 13525 | |
| 13526 | /* toggle speaker-output according to the hp-jack state */ |
| 13527 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 13528 | { |
| 13529 | unsigned int present; |
| 13530 | |
| 13531 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13532 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13533 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13534 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13535 | } |
| 13536 | |
| 13537 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 13538 | { |
| 13539 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13540 | alc861vd_dallas_automute(codec); |
| 13541 | } |
| 13542 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13543 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13544 | #define alc861vd_loopbacks alc880_loopbacks |
| 13545 | #endif |
| 13546 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13547 | /* pcm configuration: identiacal with ALC880 */ |
| 13548 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 13549 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 13550 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 13551 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 13552 | |
| 13553 | /* |
| 13554 | * configuration and preset |
| 13555 | */ |
| 13556 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 13557 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13558 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13559 | [ALC861VD_3ST] = "3stack", |
| 13560 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 13561 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13562 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13563 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13564 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13565 | [ALC861VD_AUTO] = "auto", |
| 13566 | }; |
| 13567 | |
| 13568 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13569 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 13570 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 13571 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13572 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Alexander Holler | 2522d73 | 2008-07-17 23:36:15 +0200 | [diff] [blame] | 13573 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13574 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13575 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13576 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 13577 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13578 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 13579 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13580 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 13581 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13582 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 13583 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Takashi Iwai | be321a89 | 2008-07-07 16:04:04 +0200 | [diff] [blame] | 13584 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 13585 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13586 | {} |
| 13587 | }; |
| 13588 | |
| 13589 | static struct alc_config_preset alc861vd_presets[] = { |
| 13590 | [ALC660VD_3ST] = { |
| 13591 | .mixers = { alc861vd_3st_mixer }, |
| 13592 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13593 | alc861vd_3stack_init_verbs }, |
| 13594 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13595 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13596 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13597 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13598 | .input_mux = &alc861vd_capture_source, |
| 13599 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13600 | [ALC660VD_3ST_DIG] = { |
| 13601 | .mixers = { alc861vd_3st_mixer }, |
| 13602 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13603 | alc861vd_3stack_init_verbs }, |
| 13604 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13605 | .dac_nids = alc660vd_dac_nids, |
| 13606 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13607 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13608 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13609 | .input_mux = &alc861vd_capture_source, |
| 13610 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13611 | [ALC861VD_3ST] = { |
| 13612 | .mixers = { alc861vd_3st_mixer }, |
| 13613 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13614 | alc861vd_3stack_init_verbs }, |
| 13615 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13616 | .dac_nids = alc861vd_dac_nids, |
| 13617 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13618 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13619 | .input_mux = &alc861vd_capture_source, |
| 13620 | }, |
| 13621 | [ALC861VD_3ST_DIG] = { |
| 13622 | .mixers = { alc861vd_3st_mixer }, |
| 13623 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13624 | alc861vd_3stack_init_verbs }, |
| 13625 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13626 | .dac_nids = alc861vd_dac_nids, |
| 13627 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 13628 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13629 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13630 | .input_mux = &alc861vd_capture_source, |
| 13631 | }, |
| 13632 | [ALC861VD_6ST_DIG] = { |
| 13633 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 13634 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13635 | alc861vd_6stack_init_verbs }, |
| 13636 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13637 | .dac_nids = alc861vd_dac_nids, |
| 13638 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 13639 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 13640 | .channel_mode = alc861vd_6stack_modes, |
| 13641 | .input_mux = &alc861vd_capture_source, |
| 13642 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13643 | [ALC861VD_LENOVO] = { |
| 13644 | .mixers = { alc861vd_lenovo_mixer }, |
| 13645 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13646 | alc861vd_3stack_init_verbs, |
| 13647 | alc861vd_eapd_verbs, |
| 13648 | alc861vd_lenovo_unsol_verbs }, |
| 13649 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13650 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13651 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13652 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13653 | .input_mux = &alc861vd_capture_source, |
| 13654 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 13655 | .init_hook = alc861vd_lenovo_automute, |
| 13656 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13657 | [ALC861VD_DALLAS] = { |
| 13658 | .mixers = { alc861vd_dallas_mixer }, |
| 13659 | .init_verbs = { alc861vd_dallas_verbs }, |
| 13660 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13661 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13662 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13663 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13664 | .input_mux = &alc861vd_dallas_capture_source, |
| 13665 | .unsol_event = alc861vd_dallas_unsol_event, |
| 13666 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13667 | }, |
| 13668 | [ALC861VD_HP] = { |
| 13669 | .mixers = { alc861vd_hp_mixer }, |
| 13670 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 13671 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13672 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13673 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13674 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13675 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13676 | .input_mux = &alc861vd_hp_capture_source, |
| 13677 | .unsol_event = alc861vd_dallas_unsol_event, |
| 13678 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13679 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13680 | }; |
| 13681 | |
| 13682 | /* |
| 13683 | * BIOS auto configuration |
| 13684 | */ |
| 13685 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13686 | hda_nid_t nid, int pin_type, int dac_idx) |
| 13687 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13688 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13689 | } |
| 13690 | |
| 13691 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 13692 | { |
| 13693 | struct alc_spec *spec = codec->spec; |
| 13694 | int i; |
| 13695 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13696 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13697 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13698 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13699 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13700 | if (nid) |
| 13701 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13702 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13703 | } |
| 13704 | } |
| 13705 | |
| 13706 | |
| 13707 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 13708 | { |
| 13709 | struct alc_spec *spec = codec->spec; |
| 13710 | hda_nid_t pin; |
| 13711 | |
| 13712 | pin = spec->autocfg.hp_pins[0]; |
| 13713 | if (pin) /* connect to front and use dac 0 */ |
| 13714 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13715 | pin = spec->autocfg.speaker_pins[0]; |
| 13716 | if (pin) |
| 13717 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13718 | } |
| 13719 | |
| 13720 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13721 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 13722 | |
| 13723 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 13724 | { |
| 13725 | struct alc_spec *spec = codec->spec; |
| 13726 | int i; |
| 13727 | |
| 13728 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13729 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13730 | if (alc861vd_is_input_pin(nid)) { |
| 13731 | snd_hda_codec_write(codec, nid, 0, |
| 13732 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13733 | i <= AUTO_PIN_FRONT_MIC ? |
| 13734 | PIN_VREF80 : PIN_IN); |
| 13735 | if (nid != ALC861VD_PIN_CD_NID) |
| 13736 | snd_hda_codec_write(codec, nid, 0, |
| 13737 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13738 | AMP_OUT_MUTE); |
| 13739 | } |
| 13740 | } |
| 13741 | } |
| 13742 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 13743 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 13744 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13745 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 13746 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 13747 | |
| 13748 | /* add playback controls from the parsed DAC table */ |
| 13749 | /* Based on ALC880 version. But ALC861VD has separate, |
| 13750 | * different NIDs for mute/unmute switch and volume control */ |
| 13751 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13752 | const struct auto_pin_cfg *cfg) |
| 13753 | { |
| 13754 | char name[32]; |
| 13755 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 13756 | hda_nid_t nid_v, nid_s; |
| 13757 | int i, err; |
| 13758 | |
| 13759 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13760 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13761 | continue; |
| 13762 | nid_v = alc861vd_idx_to_mixer_vol( |
| 13763 | alc880_dac_to_idx( |
| 13764 | spec->multiout.dac_nids[i])); |
| 13765 | nid_s = alc861vd_idx_to_mixer_switch( |
| 13766 | alc880_dac_to_idx( |
| 13767 | spec->multiout.dac_nids[i])); |
| 13768 | |
| 13769 | if (i == 2) { |
| 13770 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13771 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13772 | "Center Playback Volume", |
| 13773 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 13774 | HDA_OUTPUT)); |
| 13775 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13776 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13777 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13778 | "LFE Playback Volume", |
| 13779 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 13780 | HDA_OUTPUT)); |
| 13781 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13782 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13783 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13784 | "Center Playback Switch", |
| 13785 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 13786 | HDA_INPUT)); |
| 13787 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13788 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13789 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13790 | "LFE Playback Switch", |
| 13791 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 13792 | HDA_INPUT)); |
| 13793 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13794 | return err; |
| 13795 | } else { |
| 13796 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13797 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13798 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 13799 | HDA_OUTPUT)); |
| 13800 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13801 | return err; |
| 13802 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13803 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13804 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13805 | HDA_INPUT)); |
| 13806 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13807 | return err; |
| 13808 | } |
| 13809 | } |
| 13810 | return 0; |
| 13811 | } |
| 13812 | |
| 13813 | /* add playback controls for speaker and HP outputs */ |
| 13814 | /* Based on ALC880 version. But ALC861VD has separate, |
| 13815 | * different NIDs for mute/unmute switch and volume control */ |
| 13816 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 13817 | hda_nid_t pin, const char *pfx) |
| 13818 | { |
| 13819 | hda_nid_t nid_v, nid_s; |
| 13820 | int err; |
| 13821 | char name[32]; |
| 13822 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13823 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13824 | return 0; |
| 13825 | |
| 13826 | if (alc880_is_fixed_pin(pin)) { |
| 13827 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13828 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13829 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13830 | spec->multiout.hp_nid = nid_v; |
| 13831 | else |
| 13832 | spec->multiout.extra_out_nid[0] = nid_v; |
| 13833 | /* control HP volume/switch on the output mixer amp */ |
| 13834 | nid_v = alc861vd_idx_to_mixer_vol( |
| 13835 | alc880_fixed_pin_idx(pin)); |
| 13836 | nid_s = alc861vd_idx_to_mixer_switch( |
| 13837 | alc880_fixed_pin_idx(pin)); |
| 13838 | |
| 13839 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13840 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13841 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 13842 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13843 | return err; |
| 13844 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13845 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13846 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 13847 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13848 | return err; |
| 13849 | } else if (alc880_is_multi_pin(pin)) { |
| 13850 | /* set manual connection */ |
| 13851 | /* we have only a switch on HP-out PIN */ |
| 13852 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13853 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13854 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13855 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13856 | return err; |
| 13857 | } |
| 13858 | return 0; |
| 13859 | } |
| 13860 | |
| 13861 | /* parse the BIOS configuration and set up the alc_spec |
| 13862 | * return 1 if successful, 0 if the proper config is not found, |
| 13863 | * or a negative error code |
| 13864 | * Based on ALC880 version - had to change it to override |
| 13865 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 13866 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 13867 | { |
| 13868 | struct alc_spec *spec = codec->spec; |
| 13869 | int err; |
| 13870 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 13871 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13872 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13873 | alc861vd_ignore); |
| 13874 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13875 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13876 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13877 | return 0; /* can't find valid BIOS pin config */ |
| 13878 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13879 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13880 | if (err < 0) |
| 13881 | return err; |
| 13882 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13883 | if (err < 0) |
| 13884 | return err; |
| 13885 | err = alc861vd_auto_create_extra_out(spec, |
| 13886 | spec->autocfg.speaker_pins[0], |
| 13887 | "Speaker"); |
| 13888 | if (err < 0) |
| 13889 | return err; |
| 13890 | err = alc861vd_auto_create_extra_out(spec, |
| 13891 | spec->autocfg.hp_pins[0], |
| 13892 | "Headphone"); |
| 13893 | if (err < 0) |
| 13894 | return err; |
| 13895 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13896 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13897 | return err; |
| 13898 | |
| 13899 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13900 | |
| 13901 | if (spec->autocfg.dig_out_pin) |
| 13902 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 13903 | |
| 13904 | if (spec->kctl_alloc) |
| 13905 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13906 | |
| 13907 | spec->init_verbs[spec->num_init_verbs++] |
| 13908 | = alc861vd_volume_init_verbs; |
| 13909 | |
| 13910 | spec->num_mux_defs = 1; |
| 13911 | spec->input_mux = &spec->private_imux; |
| 13912 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13913 | err = alc_auto_add_mic_boost(codec); |
| 13914 | if (err < 0) |
| 13915 | return err; |
| 13916 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13917 | return 1; |
| 13918 | } |
| 13919 | |
| 13920 | /* additional initialization for auto-configuration model */ |
| 13921 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 13922 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13923 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13924 | alc861vd_auto_init_multi_out(codec); |
| 13925 | alc861vd_auto_init_hp_out(codec); |
| 13926 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 13927 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13928 | if (spec->unsol_event) |
| 13929 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13930 | } |
| 13931 | |
| 13932 | static int patch_alc861vd(struct hda_codec *codec) |
| 13933 | { |
| 13934 | struct alc_spec *spec; |
| 13935 | int err, board_config; |
| 13936 | |
| 13937 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13938 | if (spec == NULL) |
| 13939 | return -ENOMEM; |
| 13940 | |
| 13941 | codec->spec = spec; |
| 13942 | |
| 13943 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 13944 | alc861vd_models, |
| 13945 | alc861vd_cfg_tbl); |
| 13946 | |
| 13947 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 13948 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 13949 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 13950 | board_config = ALC861VD_AUTO; |
| 13951 | } |
| 13952 | |
| 13953 | if (board_config == ALC861VD_AUTO) { |
| 13954 | /* automatic parse from the BIOS config */ |
| 13955 | err = alc861vd_parse_auto_config(codec); |
| 13956 | if (err < 0) { |
| 13957 | alc_free(codec); |
| 13958 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13959 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13960 | printk(KERN_INFO |
| 13961 | "hda_codec: Cannot set up configuration " |
| 13962 | "from BIOS. Using base mode...\n"); |
| 13963 | board_config = ALC861VD_3ST; |
| 13964 | } |
| 13965 | } |
| 13966 | |
| 13967 | if (board_config != ALC861VD_AUTO) |
| 13968 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 13969 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 13970 | if (codec->vendor_id == 0x10ec0660) { |
| 13971 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 13972 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 13973 | /* always turn on EAPD */ |
| 13974 | spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 13975 | } else { |
| 13976 | spec->stream_name_analog = "ALC861VD Analog"; |
| 13977 | spec->stream_name_digital = "ALC861VD Digital"; |
| 13978 | } |
| 13979 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13980 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 13981 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 13982 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13983 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 13984 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 13985 | |
| 13986 | spec->adc_nids = alc861vd_adc_nids; |
| 13987 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13988 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13989 | |
| 13990 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 13991 | spec->num_mixers++; |
| 13992 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13993 | spec->vmaster_nid = 0x02; |
| 13994 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13995 | codec->patch_ops = alc_patch_ops; |
| 13996 | |
| 13997 | if (board_config == ALC861VD_AUTO) |
| 13998 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13999 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14000 | if (!spec->loopback.amplist) |
| 14001 | spec->loopback.amplist = alc861vd_loopbacks; |
| 14002 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14003 | |
| 14004 | return 0; |
| 14005 | } |
| 14006 | |
| 14007 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14008 | * ALC662 support |
| 14009 | * |
| 14010 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 14011 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 14012 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 14013 | * 6-channel independent captures. |
| 14014 | * |
| 14015 | * In addition, an independent DAC for the multi-playback (not used in this |
| 14016 | * driver yet). |
| 14017 | */ |
| 14018 | #define ALC662_DIGOUT_NID 0x06 |
| 14019 | #define ALC662_DIGIN_NID 0x0a |
| 14020 | |
| 14021 | static hda_nid_t alc662_dac_nids[4] = { |
| 14022 | /* front, rear, clfe, rear_surr */ |
| 14023 | 0x02, 0x03, 0x04 |
| 14024 | }; |
| 14025 | |
| 14026 | static hda_nid_t alc662_adc_nids[1] = { |
| 14027 | /* ADC1-2 */ |
| 14028 | 0x09, |
| 14029 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14030 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 14031 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14032 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14033 | /* input MUX */ |
| 14034 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14035 | static struct hda_input_mux alc662_capture_source = { |
| 14036 | .num_items = 4, |
| 14037 | .items = { |
| 14038 | { "Mic", 0x0 }, |
| 14039 | { "Front Mic", 0x1 }, |
| 14040 | { "Line", 0x2 }, |
| 14041 | { "CD", 0x4 }, |
| 14042 | }, |
| 14043 | }; |
| 14044 | |
| 14045 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 14046 | .num_items = 2, |
| 14047 | .items = { |
| 14048 | { "Mic", 0x1 }, |
| 14049 | { "Line", 0x2 }, |
| 14050 | }, |
| 14051 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14052 | |
| 14053 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 14054 | .num_items = 2, |
| 14055 | .items = { |
| 14056 | { "i-Mic", 0x1 }, |
| 14057 | { "e-Mic", 0x0 }, |
| 14058 | }, |
| 14059 | }; |
| 14060 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14061 | static struct hda_input_mux alc663_capture_source = { |
| 14062 | .num_items = 3, |
| 14063 | .items = { |
| 14064 | { "Mic", 0x0 }, |
| 14065 | { "Front Mic", 0x1 }, |
| 14066 | { "Line", 0x2 }, |
| 14067 | }, |
| 14068 | }; |
| 14069 | |
| 14070 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 14071 | .num_items = 2, |
| 14072 | .items = { |
| 14073 | { "Ext-Mic", 0x0 }, |
| 14074 | { "D-Mic", 0x9 }, |
| 14075 | }, |
| 14076 | }; |
| 14077 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14078 | #define alc662_mux_enum_info alc_mux_enum_info |
| 14079 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14080 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14081 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14082 | /* |
| 14083 | * 2ch mode |
| 14084 | */ |
| 14085 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 14086 | { 2, NULL } |
| 14087 | }; |
| 14088 | |
| 14089 | /* |
| 14090 | * 2ch mode |
| 14091 | */ |
| 14092 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 14093 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 14094 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14095 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 14096 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14097 | { } /* end */ |
| 14098 | }; |
| 14099 | |
| 14100 | /* |
| 14101 | * 6ch mode |
| 14102 | */ |
| 14103 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 14104 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14105 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14106 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 14107 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14108 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14109 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14110 | { } /* end */ |
| 14111 | }; |
| 14112 | |
| 14113 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 14114 | { 2, alc662_3ST_ch2_init }, |
| 14115 | { 6, alc662_3ST_ch6_init }, |
| 14116 | }; |
| 14117 | |
| 14118 | /* |
| 14119 | * 2ch mode |
| 14120 | */ |
| 14121 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 14122 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14123 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14124 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14125 | { } /* end */ |
| 14126 | }; |
| 14127 | |
| 14128 | /* |
| 14129 | * 6ch mode |
| 14130 | */ |
| 14131 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 14132 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14133 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14134 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14135 | { } /* end */ |
| 14136 | }; |
| 14137 | |
| 14138 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 14139 | { 2, alc662_sixstack_ch6_init }, |
| 14140 | { 6, alc662_sixstack_ch8_init }, |
| 14141 | }; |
| 14142 | |
| 14143 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14144 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14145 | */ |
| 14146 | |
| 14147 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 14148 | /* output mixer control */ |
| 14149 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14150 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14151 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14152 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14153 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14154 | 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] | 14155 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14156 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14157 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14158 | |
| 14159 | /*Input mixer control */ |
| 14160 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 14161 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 14162 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 14163 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 14164 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 14165 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 14166 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 14167 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14168 | { } /* end */ |
| 14169 | }; |
| 14170 | |
| 14171 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 14172 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14173 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14174 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14175 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14176 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14177 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14178 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14179 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14180 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14181 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14182 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14183 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14184 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14185 | { } /* end */ |
| 14186 | }; |
| 14187 | |
| 14188 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 14189 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14190 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14191 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14192 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14193 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14194 | 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] | 14195 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14196 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14197 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14198 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14199 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14200 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14201 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14202 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14203 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14204 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14205 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14206 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14207 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14208 | { } /* end */ |
| 14209 | }; |
| 14210 | |
| 14211 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 14212 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14213 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14214 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14215 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14216 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14217 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14218 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14219 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14221 | { } /* end */ |
| 14222 | }; |
| 14223 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14224 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14225 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14226 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 14227 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14228 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14229 | |
| 14230 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 14231 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14232 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14233 | |
| 14234 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 14235 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14236 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14237 | { } /* end */ |
| 14238 | }; |
| 14239 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14240 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 14241 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14242 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14243 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14244 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 14245 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14246 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 14247 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 14248 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14249 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14250 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14251 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14252 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14254 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14255 | { } /* end */ |
| 14256 | }; |
| 14257 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14258 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
| 14259 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14260 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14261 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14263 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14264 | HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), |
| 14265 | { } /* end */ |
| 14266 | }; |
| 14267 | |
| 14268 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 14269 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14270 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14271 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14272 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14273 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14274 | |
| 14275 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14276 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14277 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14278 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14279 | { } /* end */ |
| 14280 | }; |
| 14281 | |
| 14282 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 14283 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14284 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14285 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14286 | |
| 14287 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14288 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14289 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14290 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14291 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14292 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14293 | { } /* end */ |
| 14294 | }; |
| 14295 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14296 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 14297 | { |
| 14298 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14299 | .name = "Channel Mode", |
| 14300 | .info = alc_ch_mode_info, |
| 14301 | .get = alc_ch_mode_get, |
| 14302 | .put = alc_ch_mode_put, |
| 14303 | }, |
| 14304 | { } /* end */ |
| 14305 | }; |
| 14306 | |
| 14307 | static struct hda_verb alc662_init_verbs[] = { |
| 14308 | /* ADC: mute amp left and right */ |
| 14309 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14310 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14311 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 14312 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14313 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14314 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14315 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14316 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14317 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14318 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14319 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14320 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14321 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14322 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14323 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14324 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14325 | |
| 14326 | /* Front Pin: output 0 (0x0c) */ |
| 14327 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14328 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14329 | |
| 14330 | /* Rear Pin: output 1 (0x0d) */ |
| 14331 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14332 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14333 | |
| 14334 | /* CLFE Pin: output 2 (0x0e) */ |
| 14335 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14336 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14337 | |
| 14338 | /* Mic (rear) pin: input vref at 80% */ |
| 14339 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14340 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14341 | /* Front Mic pin: input vref at 80% */ |
| 14342 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14343 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14344 | /* Line In pin: input */ |
| 14345 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14346 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14347 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14348 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14349 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14350 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14351 | /* CD pin widget for input */ |
| 14352 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14353 | |
| 14354 | /* FIXME: use matrix-type input source selection */ |
| 14355 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 14356 | /* Input mixer */ |
| 14357 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14358 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14359 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14360 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14361 | |
| 14362 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14364 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14365 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14366 | |
| 14367 | /* always trun on EAPD */ |
| 14368 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14369 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14370 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14371 | { } |
| 14372 | }; |
| 14373 | |
| 14374 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 14375 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 14376 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14377 | {} |
| 14378 | }; |
| 14379 | |
| 14380 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 14381 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14382 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14383 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14384 | }; |
| 14385 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14386 | /* Set Unsolicited Event*/ |
| 14387 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 14388 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14389 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14390 | {} |
| 14391 | }; |
| 14392 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14393 | /* |
| 14394 | * generic initialization of ADC, input mixers and output mixers |
| 14395 | */ |
| 14396 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 14397 | /* |
| 14398 | * Unmute ADC and set the default input to mic-in |
| 14399 | */ |
| 14400 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14401 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14402 | |
| 14403 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 14404 | * mixer widget |
| 14405 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 14406 | * panel mic (mic 2) |
| 14407 | */ |
| 14408 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14409 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14410 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14411 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14412 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14413 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14414 | |
| 14415 | /* |
| 14416 | * Set up output mixers (0x0c - 0x0f) |
| 14417 | */ |
| 14418 | /* set vol=0 to output mixers */ |
| 14419 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14420 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14421 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14422 | |
| 14423 | /* set up input amps for analog loopback */ |
| 14424 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14425 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14426 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14427 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14428 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14429 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14430 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14431 | |
| 14432 | |
| 14433 | /* FIXME: use matrix-type input source selection */ |
| 14434 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 14435 | /* Input mixer */ |
| 14436 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14437 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14438 | { } |
| 14439 | }; |
| 14440 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 14441 | /* additional verbs for ALC663 */ |
| 14442 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 14443 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14444 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14445 | { } |
| 14446 | }; |
| 14447 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14448 | static struct hda_verb alc663_m51va_init_verbs[] = { |
| 14449 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14450 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14451 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14452 | |
| 14453 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 14454 | |
| 14455 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14456 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14457 | {} |
| 14458 | }; |
| 14459 | |
| 14460 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 14461 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14462 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 14463 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 14464 | |
| 14465 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14466 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14467 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14468 | |
| 14469 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 14470 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 14471 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 14472 | {} |
| 14473 | }; |
| 14474 | |
| 14475 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 14476 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14477 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14478 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14479 | |
| 14480 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14481 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14482 | {} |
| 14483 | }; |
| 14484 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14485 | /* capture mixer elements */ |
| 14486 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 14487 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14488 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14489 | { |
| 14490 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14491 | /* The multiple "Capture Source" controls confuse alsamixer |
| 14492 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14493 | */ |
| 14494 | /* .name = "Capture Source", */ |
| 14495 | .name = "Input Source", |
| 14496 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 14497 | .info = alc662_mux_enum_info, |
| 14498 | .get = alc662_mux_enum_get, |
| 14499 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14500 | }, |
| 14501 | { } /* end */ |
| 14502 | }; |
| 14503 | |
| 14504 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 14505 | { |
| 14506 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14507 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14508 | |
| 14509 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 14510 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14511 | bits = present ? HDA_AMP_MUTE : 0; |
| 14512 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14513 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14514 | } |
| 14515 | |
| 14516 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 14517 | { |
| 14518 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14519 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14520 | |
| 14521 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14522 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14523 | bits = present ? HDA_AMP_MUTE : 0; |
| 14524 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14525 | HDA_AMP_MUTE, bits); |
| 14526 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14527 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14528 | } |
| 14529 | |
| 14530 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 14531 | unsigned int res) |
| 14532 | { |
| 14533 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14534 | alc662_lenovo_101e_all_automute(codec); |
| 14535 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 14536 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 14537 | } |
| 14538 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14539 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 14540 | { |
| 14541 | unsigned int present; |
| 14542 | |
| 14543 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14544 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 14545 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14546 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 14547 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14548 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 14549 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14550 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 14551 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14552 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 14553 | } |
| 14554 | |
| 14555 | /* unsolicited event for HP jack sensing */ |
| 14556 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 14557 | unsigned int res) |
| 14558 | { |
| 14559 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14560 | alc262_hippo1_automute( codec ); |
| 14561 | |
| 14562 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14563 | alc662_eeepc_mic_automute(codec); |
| 14564 | } |
| 14565 | |
| 14566 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 14567 | { |
| 14568 | alc262_hippo1_automute( codec ); |
| 14569 | alc662_eeepc_mic_automute(codec); |
| 14570 | } |
| 14571 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14572 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 14573 | { |
| 14574 | unsigned int mute; |
| 14575 | unsigned int present; |
| 14576 | |
| 14577 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 14578 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 14579 | AC_VERB_GET_PIN_SENSE, 0); |
| 14580 | present = (present & 0x80000000) != 0; |
| 14581 | if (present) { |
| 14582 | /* mute internal speaker */ |
| 14583 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14584 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14585 | } else { |
| 14586 | /* unmute internal speaker if necessary */ |
| 14587 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 14588 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14589 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14590 | } |
| 14591 | } |
| 14592 | |
| 14593 | /* unsolicited event for HP jack sensing */ |
| 14594 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 14595 | unsigned int res) |
| 14596 | { |
| 14597 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14598 | alc662_eeepc_ep20_automute(codec); |
| 14599 | } |
| 14600 | |
| 14601 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 14602 | { |
| 14603 | alc662_eeepc_ep20_automute(codec); |
| 14604 | } |
| 14605 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14606 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 14607 | { |
| 14608 | unsigned int present; |
| 14609 | unsigned char bits; |
| 14610 | |
| 14611 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 14612 | AC_VERB_GET_PIN_SENSE, 0) |
| 14613 | & AC_PINSENSE_PRESENCE; |
| 14614 | bits = present ? HDA_AMP_MUTE : 0; |
| 14615 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14616 | HDA_AMP_MUTE, bits); |
| 14617 | } |
| 14618 | |
| 14619 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 14620 | { |
| 14621 | unsigned int present; |
| 14622 | |
| 14623 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14624 | AC_VERB_GET_PIN_SENSE, 0) |
| 14625 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14626 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14627 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14628 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14629 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14630 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14631 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14632 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14633 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14634 | } |
| 14635 | |
| 14636 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 14637 | unsigned int res) |
| 14638 | { |
| 14639 | switch (res >> 26) { |
| 14640 | case ALC880_HP_EVENT: |
| 14641 | alc663_m51va_speaker_automute(codec); |
| 14642 | break; |
| 14643 | case ALC880_MIC_EVENT: |
| 14644 | alc663_m51va_mic_automute(codec); |
| 14645 | break; |
| 14646 | } |
| 14647 | } |
| 14648 | |
| 14649 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 14650 | { |
| 14651 | alc663_m51va_speaker_automute(codec); |
| 14652 | alc663_m51va_mic_automute(codec); |
| 14653 | } |
| 14654 | |
| 14655 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 14656 | { |
| 14657 | unsigned int present; |
| 14658 | unsigned char bits; |
| 14659 | |
| 14660 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 14661 | AC_VERB_GET_PIN_SENSE, 0) |
| 14662 | & AC_PINSENSE_PRESENCE; |
| 14663 | bits = present ? HDA_AMP_MUTE : 0; |
| 14664 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14665 | HDA_AMP_MUTE, bits); |
| 14666 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14667 | HDA_AMP_MUTE, bits); |
| 14668 | } |
| 14669 | |
| 14670 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 14671 | { |
| 14672 | unsigned int present; |
| 14673 | unsigned char bits; |
| 14674 | |
| 14675 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14676 | AC_VERB_GET_PIN_SENSE, 0) |
| 14677 | & AC_PINSENSE_PRESENCE; |
| 14678 | bits = present ? HDA_AMP_MUTE : 0; |
| 14679 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14680 | HDA_AMP_MUTE, bits); |
| 14681 | } |
| 14682 | |
| 14683 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 14684 | unsigned int res) |
| 14685 | { |
| 14686 | switch (res >> 26) { |
| 14687 | case ALC880_HP_EVENT: |
| 14688 | alc663_g71v_hp_automute(codec); |
| 14689 | break; |
| 14690 | case ALC880_FRONT_EVENT: |
| 14691 | alc663_g71v_front_automute(codec); |
| 14692 | break; |
| 14693 | case ALC880_MIC_EVENT: |
| 14694 | alc662_eeepc_mic_automute(codec); |
| 14695 | break; |
| 14696 | } |
| 14697 | } |
| 14698 | |
| 14699 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 14700 | { |
| 14701 | alc663_g71v_front_automute(codec); |
| 14702 | alc663_g71v_hp_automute(codec); |
| 14703 | alc662_eeepc_mic_automute(codec); |
| 14704 | } |
| 14705 | |
| 14706 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 14707 | unsigned int res) |
| 14708 | { |
| 14709 | switch (res >> 26) { |
| 14710 | case ALC880_HP_EVENT: |
| 14711 | alc663_m51va_speaker_automute(codec); |
| 14712 | break; |
| 14713 | case ALC880_MIC_EVENT: |
| 14714 | alc662_eeepc_mic_automute(codec); |
| 14715 | break; |
| 14716 | } |
| 14717 | } |
| 14718 | |
| 14719 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 14720 | { |
| 14721 | alc663_m51va_speaker_automute(codec); |
| 14722 | alc662_eeepc_mic_automute(codec); |
| 14723 | } |
| 14724 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14725 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14726 | #define alc662_loopbacks alc880_loopbacks |
| 14727 | #endif |
| 14728 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14729 | |
| 14730 | /* pcm configuration: identiacal with ALC880 */ |
| 14731 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 14732 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 14733 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 14734 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 14735 | |
| 14736 | /* |
| 14737 | * configuration and preset |
| 14738 | */ |
| 14739 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 14740 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 14741 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 14742 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 14743 | [ALC662_5ST_DIG] = "6stack-dig", |
| 14744 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 14745 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14746 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14747 | [ALC663_ASUS_M51VA] = "m51va", |
| 14748 | [ALC663_ASUS_G71V] = "g71v", |
| 14749 | [ALC663_ASUS_H13] = "h13", |
| 14750 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14751 | [ALC662_AUTO] = "auto", |
| 14752 | }; |
| 14753 | |
| 14754 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14755 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V), |
| 14756 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
| 14757 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 14758 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14759 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14760 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14761 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14762 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
| 14763 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
| 14764 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14765 | {} |
| 14766 | }; |
| 14767 | |
| 14768 | static struct alc_config_preset alc662_presets[] = { |
| 14769 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14770 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14771 | .init_verbs = { alc662_init_verbs }, |
| 14772 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14773 | .dac_nids = alc662_dac_nids, |
| 14774 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14775 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14776 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14777 | .channel_mode = alc662_3ST_2ch_modes, |
| 14778 | .input_mux = &alc662_capture_source, |
| 14779 | }, |
| 14780 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14781 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 14782 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14783 | .init_verbs = { alc662_init_verbs }, |
| 14784 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14785 | .dac_nids = alc662_dac_nids, |
| 14786 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14787 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14788 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14789 | .channel_mode = alc662_3ST_6ch_modes, |
| 14790 | .need_dac_fix = 1, |
| 14791 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14792 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14793 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14794 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 14795 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14796 | .init_verbs = { alc662_init_verbs }, |
| 14797 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14798 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14799 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14800 | .channel_mode = alc662_3ST_6ch_modes, |
| 14801 | .need_dac_fix = 1, |
| 14802 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14803 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14804 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14805 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 14806 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14807 | .init_verbs = { alc662_init_verbs }, |
| 14808 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14809 | .dac_nids = alc662_dac_nids, |
| 14810 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14811 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14812 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 14813 | .channel_mode = alc662_5stack_modes, |
| 14814 | .input_mux = &alc662_capture_source, |
| 14815 | }, |
| 14816 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14817 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14818 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 14819 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14820 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14821 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14822 | .channel_mode = alc662_3ST_2ch_modes, |
| 14823 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 14824 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 14825 | .init_hook = alc662_lenovo_101e_all_automute, |
| 14826 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14827 | [ALC662_ASUS_EEEPC_P701] = { |
| 14828 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 14829 | .init_verbs = { alc662_init_verbs, |
| 14830 | alc662_eeepc_sue_init_verbs }, |
| 14831 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14832 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14833 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14834 | .channel_mode = alc662_3ST_2ch_modes, |
| 14835 | .input_mux = &alc662_eeepc_capture_source, |
| 14836 | .unsol_event = alc662_eeepc_unsol_event, |
| 14837 | .init_hook = alc662_eeepc_inithook, |
| 14838 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14839 | [ALC662_ASUS_EEEPC_EP20] = { |
| 14840 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 14841 | alc662_chmode_mixer }, |
| 14842 | .init_verbs = { alc662_init_verbs, |
| 14843 | alc662_eeepc_ep20_sue_init_verbs }, |
| 14844 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14845 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14846 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14847 | .channel_mode = alc662_3ST_6ch_modes, |
| 14848 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 14849 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 14850 | .init_hook = alc662_eeepc_ep20_inithook, |
| 14851 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14852 | [ALC663_ASUS_M51VA] = { |
| 14853 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 14854 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 14855 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14856 | .dac_nids = alc662_dac_nids, |
| 14857 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14858 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14859 | .channel_mode = alc662_3ST_2ch_modes, |
| 14860 | .input_mux = &alc663_m51va_capture_source, |
| 14861 | .unsol_event = alc663_m51va_unsol_event, |
| 14862 | .init_hook = alc663_m51va_inithook, |
| 14863 | }, |
| 14864 | [ALC663_ASUS_G71V] = { |
| 14865 | .mixers = { alc663_g71v_mixer, alc662_capture_mixer}, |
| 14866 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 14867 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14868 | .dac_nids = alc662_dac_nids, |
| 14869 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14870 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14871 | .channel_mode = alc662_3ST_2ch_modes, |
| 14872 | .input_mux = &alc662_eeepc_capture_source, |
| 14873 | .unsol_event = alc663_g71v_unsol_event, |
| 14874 | .init_hook = alc663_g71v_inithook, |
| 14875 | }, |
| 14876 | [ALC663_ASUS_H13] = { |
| 14877 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 14878 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 14879 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14880 | .dac_nids = alc662_dac_nids, |
| 14881 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14882 | .channel_mode = alc662_3ST_2ch_modes, |
| 14883 | .input_mux = &alc663_m51va_capture_source, |
| 14884 | .unsol_event = alc663_m51va_unsol_event, |
| 14885 | .init_hook = alc663_m51va_inithook, |
| 14886 | }, |
| 14887 | [ALC663_ASUS_G50V] = { |
| 14888 | .mixers = { alc663_g50v_mixer, alc662_capture_mixer}, |
| 14889 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 14890 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14891 | .dac_nids = alc662_dac_nids, |
| 14892 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14893 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14894 | .channel_mode = alc662_3ST_6ch_modes, |
| 14895 | .input_mux = &alc663_capture_source, |
| 14896 | .unsol_event = alc663_g50v_unsol_event, |
| 14897 | .init_hook = alc663_g50v_inithook, |
| 14898 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14899 | }; |
| 14900 | |
| 14901 | |
| 14902 | /* |
| 14903 | * BIOS auto configuration |
| 14904 | */ |
| 14905 | |
| 14906 | /* add playback controls from the parsed DAC table */ |
| 14907 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14908 | const struct auto_pin_cfg *cfg) |
| 14909 | { |
| 14910 | char name[32]; |
| 14911 | static const char *chname[4] = { |
| 14912 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14913 | }; |
| 14914 | hda_nid_t nid; |
| 14915 | int i, err; |
| 14916 | |
| 14917 | for (i = 0; i < cfg->line_outs; i++) { |
| 14918 | if (!spec->multiout.dac_nids[i]) |
| 14919 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14920 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14921 | if (i == 2) { |
| 14922 | /* Center/LFE */ |
| 14923 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14924 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14925 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 14926 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14927 | if (err < 0) |
| 14928 | return err; |
| 14929 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14930 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14931 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 14932 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14933 | if (err < 0) |
| 14934 | return err; |
| 14935 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14936 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14937 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 14938 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14939 | if (err < 0) |
| 14940 | return err; |
| 14941 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14942 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14943 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 14944 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14945 | if (err < 0) |
| 14946 | return err; |
| 14947 | } else { |
| 14948 | sprintf(name, "%s Playback Volume", chname[i]); |
| 14949 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14950 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 14951 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14952 | if (err < 0) |
| 14953 | return err; |
| 14954 | sprintf(name, "%s Playback Switch", chname[i]); |
| 14955 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14956 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 14957 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14958 | if (err < 0) |
| 14959 | return err; |
| 14960 | } |
| 14961 | } |
| 14962 | return 0; |
| 14963 | } |
| 14964 | |
| 14965 | /* add playback controls for speaker and HP outputs */ |
| 14966 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 14967 | const char *pfx) |
| 14968 | { |
| 14969 | hda_nid_t nid; |
| 14970 | int err; |
| 14971 | char name[32]; |
| 14972 | |
| 14973 | if (!pin) |
| 14974 | return 0; |
| 14975 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 14976 | if (pin == 0x17) { |
| 14977 | /* ALC663 has a mono output pin on 0x17 */ |
| 14978 | sprintf(name, "%s Playback Switch", pfx); |
| 14979 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14980 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 14981 | return err; |
| 14982 | } |
| 14983 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14984 | if (alc880_is_fixed_pin(pin)) { |
| 14985 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14986 | /* printk("DAC nid=%x\n",nid); */ |
| 14987 | /* specify the DAC as the extra output */ |
| 14988 | if (!spec->multiout.hp_nid) |
| 14989 | spec->multiout.hp_nid = nid; |
| 14990 | else |
| 14991 | spec->multiout.extra_out_nid[0] = nid; |
| 14992 | /* control HP volume/switch on the output mixer amp */ |
| 14993 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14994 | sprintf(name, "%s Playback Volume", pfx); |
| 14995 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14996 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 14997 | if (err < 0) |
| 14998 | return err; |
| 14999 | sprintf(name, "%s Playback Switch", pfx); |
| 15000 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15001 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 15002 | if (err < 0) |
| 15003 | return err; |
| 15004 | } else if (alc880_is_multi_pin(pin)) { |
| 15005 | /* set manual connection */ |
| 15006 | /* we have only a switch on HP-out PIN */ |
| 15007 | sprintf(name, "%s Playback Switch", pfx); |
| 15008 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15009 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15010 | if (err < 0) |
| 15011 | return err; |
| 15012 | } |
| 15013 | return 0; |
| 15014 | } |
| 15015 | |
| 15016 | /* create playback/capture controls for input pins */ |
| 15017 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 15018 | const struct auto_pin_cfg *cfg) |
| 15019 | { |
| 15020 | struct hda_input_mux *imux = &spec->private_imux; |
| 15021 | int i, err, idx; |
| 15022 | |
| 15023 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15024 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 15025 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 15026 | err = new_analog_input(spec, cfg->input_pins[i], |
| 15027 | auto_pin_cfg_labels[i], |
| 15028 | idx, 0x0b); |
| 15029 | if (err < 0) |
| 15030 | return err; |
| 15031 | imux->items[imux->num_items].label = |
| 15032 | auto_pin_cfg_labels[i]; |
| 15033 | imux->items[imux->num_items].index = |
| 15034 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 15035 | imux->num_items++; |
| 15036 | } |
| 15037 | } |
| 15038 | return 0; |
| 15039 | } |
| 15040 | |
| 15041 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15042 | hda_nid_t nid, int pin_type, |
| 15043 | int dac_idx) |
| 15044 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15045 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15046 | /* need the manual connection? */ |
| 15047 | if (alc880_is_multi_pin(nid)) { |
| 15048 | struct alc_spec *spec = codec->spec; |
| 15049 | int idx = alc880_multi_pin_idx(nid); |
| 15050 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 15051 | AC_VERB_SET_CONNECT_SEL, |
| 15052 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 15053 | } |
| 15054 | } |
| 15055 | |
| 15056 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 15057 | { |
| 15058 | struct alc_spec *spec = codec->spec; |
| 15059 | int i; |
| 15060 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15061 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15062 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15063 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15064 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15065 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15066 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15067 | i); |
| 15068 | } |
| 15069 | } |
| 15070 | |
| 15071 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 15072 | { |
| 15073 | struct alc_spec *spec = codec->spec; |
| 15074 | hda_nid_t pin; |
| 15075 | |
| 15076 | pin = spec->autocfg.hp_pins[0]; |
| 15077 | if (pin) /* connect to front */ |
| 15078 | /* use dac 0 */ |
| 15079 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15080 | pin = spec->autocfg.speaker_pins[0]; |
| 15081 | if (pin) |
| 15082 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15083 | } |
| 15084 | |
| 15085 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 15086 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 15087 | |
| 15088 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 15089 | { |
| 15090 | struct alc_spec *spec = codec->spec; |
| 15091 | int i; |
| 15092 | |
| 15093 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15094 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15095 | if (alc662_is_input_pin(nid)) { |
| 15096 | snd_hda_codec_write(codec, nid, 0, |
| 15097 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15098 | (i <= AUTO_PIN_FRONT_MIC ? |
| 15099 | PIN_VREF80 : PIN_IN)); |
| 15100 | if (nid != ALC662_PIN_CD_NID) |
| 15101 | snd_hda_codec_write(codec, nid, 0, |
| 15102 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15103 | AMP_OUT_MUTE); |
| 15104 | } |
| 15105 | } |
| 15106 | } |
| 15107 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15108 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 15109 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15110 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 15111 | { |
| 15112 | struct alc_spec *spec = codec->spec; |
| 15113 | int err; |
| 15114 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 15115 | |
| 15116 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15117 | alc662_ignore); |
| 15118 | if (err < 0) |
| 15119 | return err; |
| 15120 | if (!spec->autocfg.line_outs) |
| 15121 | return 0; /* can't find valid BIOS pin config */ |
| 15122 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15123 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15124 | if (err < 0) |
| 15125 | return err; |
| 15126 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15127 | if (err < 0) |
| 15128 | return err; |
| 15129 | err = alc662_auto_create_extra_out(spec, |
| 15130 | spec->autocfg.speaker_pins[0], |
| 15131 | "Speaker"); |
| 15132 | if (err < 0) |
| 15133 | return err; |
| 15134 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 15135 | "Headphone"); |
| 15136 | if (err < 0) |
| 15137 | return err; |
| 15138 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15139 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15140 | return err; |
| 15141 | |
| 15142 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15143 | |
| 15144 | if (spec->autocfg.dig_out_pin) |
| 15145 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 15146 | |
| 15147 | if (spec->kctl_alloc) |
| 15148 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 15149 | |
| 15150 | spec->num_mux_defs = 1; |
| 15151 | spec->input_mux = &spec->private_imux; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15152 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 15153 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15154 | if (codec->vendor_id == 0x10ec0663) |
| 15155 | spec->init_verbs[spec->num_init_verbs++] = |
| 15156 | alc663_auto_init_verbs; |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 15157 | |
| 15158 | err = alc_auto_add_mic_boost(codec); |
| 15159 | if (err < 0) |
| 15160 | return err; |
| 15161 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15162 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 15163 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 15164 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15165 | } |
| 15166 | |
| 15167 | /* additional initialization for auto-configuration model */ |
| 15168 | static void alc662_auto_init(struct hda_codec *codec) |
| 15169 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15170 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15171 | alc662_auto_init_multi_out(codec); |
| 15172 | alc662_auto_init_hp_out(codec); |
| 15173 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15174 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15175 | if (spec->unsol_event) |
| 15176 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15177 | } |
| 15178 | |
| 15179 | static int patch_alc662(struct hda_codec *codec) |
| 15180 | { |
| 15181 | struct alc_spec *spec; |
| 15182 | int err, board_config; |
| 15183 | |
| 15184 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15185 | if (!spec) |
| 15186 | return -ENOMEM; |
| 15187 | |
| 15188 | codec->spec = spec; |
| 15189 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 15190 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15191 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15192 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 15193 | alc662_models, |
| 15194 | alc662_cfg_tbl); |
| 15195 | if (board_config < 0) { |
| 15196 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 15197 | "trying auto-probe from BIOS...\n"); |
| 15198 | board_config = ALC662_AUTO; |
| 15199 | } |
| 15200 | |
| 15201 | if (board_config == ALC662_AUTO) { |
| 15202 | /* automatic parse from the BIOS config */ |
| 15203 | err = alc662_parse_auto_config(codec); |
| 15204 | if (err < 0) { |
| 15205 | alc_free(codec); |
| 15206 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 15207 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15208 | printk(KERN_INFO |
| 15209 | "hda_codec: Cannot set up configuration " |
| 15210 | "from BIOS. Using base mode...\n"); |
| 15211 | board_config = ALC662_3ST_2ch_DIG; |
| 15212 | } |
| 15213 | } |
| 15214 | |
| 15215 | if (board_config != ALC662_AUTO) |
| 15216 | setup_preset(spec, &alc662_presets[board_config]); |
| 15217 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15218 | if (codec->vendor_id == 0x10ec0663) { |
| 15219 | spec->stream_name_analog = "ALC663 Analog"; |
| 15220 | spec->stream_name_digital = "ALC663 Digital"; |
| 15221 | } else { |
| 15222 | spec->stream_name_analog = "ALC662 Analog"; |
| 15223 | spec->stream_name_digital = "ALC662 Digital"; |
| 15224 | } |
| 15225 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15226 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 15227 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 15228 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15229 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 15230 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 15231 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15232 | spec->adc_nids = alc662_adc_nids; |
| 15233 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 15234 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15235 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15236 | spec->vmaster_nid = 0x02; |
| 15237 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15238 | codec->patch_ops = alc_patch_ops; |
| 15239 | if (board_config == ALC662_AUTO) |
| 15240 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15241 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15242 | if (!spec->loopback.amplist) |
| 15243 | spec->loopback.amplist = alc662_loopbacks; |
| 15244 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15245 | |
| 15246 | return 0; |
| 15247 | } |
| 15248 | |
| 15249 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15250 | * patch entries |
| 15251 | */ |
| 15252 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 15253 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15254 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15255 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 15256 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15257 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15258 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15259 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15260 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 15261 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 15262 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15263 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 15264 | .patch = patch_alc883 }, |
| 15265 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 15266 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15267 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15268 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15269 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15270 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 15271 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 15272 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15273 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15274 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15275 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15276 | {} /* terminator */ |
| 15277 | }; |