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, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 116 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 117 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 118 | #ifdef CONFIG_SND_DEBUG |
| 119 | ALC268_TEST, |
| 120 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 121 | ALC268_AUTO, |
| 122 | ALC268_MODEL_LAST /* last tag */ |
| 123 | }; |
| 124 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 125 | /* ALC269 models */ |
| 126 | enum { |
| 127 | ALC269_BASIC, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 128 | ALC269_ASUS_EEEPC_P703, |
| 129 | ALC269_ASUS_EEEPC_P901, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | ALC269_AUTO, |
| 131 | ALC269_MODEL_LAST /* last tag */ |
| 132 | }; |
| 133 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 134 | /* ALC861 models */ |
| 135 | enum { |
| 136 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 137 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 138 | ALC861_3ST_DIG, |
| 139 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 140 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 141 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 142 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 143 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 144 | ALC861_AUTO, |
| 145 | ALC861_MODEL_LAST, |
| 146 | }; |
| 147 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 148 | /* ALC861-VD models */ |
| 149 | enum { |
| 150 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 151 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 152 | ALC861VD_3ST, |
| 153 | ALC861VD_3ST_DIG, |
| 154 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 155 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 156 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 157 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 158 | ALC861VD_AUTO, |
| 159 | ALC861VD_MODEL_LAST, |
| 160 | }; |
| 161 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 162 | /* ALC662 models */ |
| 163 | enum { |
| 164 | ALC662_3ST_2ch_DIG, |
| 165 | ALC662_3ST_6ch_DIG, |
| 166 | ALC662_3ST_6ch, |
| 167 | ALC662_5ST_DIG, |
| 168 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 169 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 170 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 171 | ALC663_ASUS_M51VA, |
| 172 | ALC663_ASUS_G71V, |
| 173 | ALC663_ASUS_H13, |
| 174 | ALC663_ASUS_G50V, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 175 | ALC662_AUTO, |
| 176 | ALC662_MODEL_LAST, |
| 177 | }; |
| 178 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 179 | /* ALC882 models */ |
| 180 | enum { |
| 181 | ALC882_3ST_DIG, |
| 182 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 183 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 184 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 185 | ALC882_TARGA, |
| 186 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 187 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 188 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 189 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 190 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 191 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 192 | ALC882_MODEL_LAST, |
| 193 | }; |
| 194 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 195 | /* ALC883 models */ |
| 196 | enum { |
| 197 | ALC883_3ST_2ch_DIG, |
| 198 | ALC883_3ST_6ch_DIG, |
| 199 | ALC883_3ST_6ch, |
| 200 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 201 | ALC883_TARGA_DIG, |
| 202 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 203 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 204 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 205 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 206 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 207 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 208 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 209 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 210 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 211 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 212 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 213 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 214 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 215 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 216 | ALC883_FUJITSU_PI2515, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 217 | ALC883_3ST_6ch_INTEL, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 218 | ALC883_AUTO, |
| 219 | ALC883_MODEL_LAST, |
| 220 | }; |
| 221 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 222 | /* for GPIO Poll */ |
| 223 | #define GPIO_MASK 0x03 |
| 224 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | struct alc_spec { |
| 226 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 227 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | unsigned int num_mixers; |
| 229 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 230 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 231 | * don't forget NULL |
| 232 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 233 | */ |
| 234 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 236 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | struct hda_pcm_stream *stream_analog_playback; |
| 238 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 239 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 240 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 242 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | struct hda_pcm_stream *stream_digital_playback; |
| 244 | struct hda_pcm_stream *stream_digital_capture; |
| 245 | |
| 246 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 247 | struct hda_multi_out multiout; /* playback set-up |
| 248 | * max_channels, dacs must be set |
| 249 | * dig_out_nid and hp_nid are optional |
| 250 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 251 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | |
| 253 | /* capture */ |
| 254 | unsigned int num_adc_nids; |
| 255 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 256 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 257 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | |
| 259 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 260 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | const struct hda_input_mux *input_mux; |
| 262 | unsigned int cur_mux[3]; |
| 263 | |
| 264 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 265 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 267 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | |
| 269 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 270 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 271 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 272 | /* dynamic controls, init_verbs and input_mux */ |
| 273 | struct auto_pin_cfg autocfg; |
| 274 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 275 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 276 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 277 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 278 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 279 | /* hooks */ |
| 280 | void (*init_hook)(struct hda_codec *codec); |
| 281 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 282 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 283 | /* for pin sensing */ |
| 284 | unsigned int sense_updated: 1; |
| 285 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 286 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 287 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 288 | /* for virtual master */ |
| 289 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 290 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 291 | struct hda_loopback_check loopback; |
| 292 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 293 | |
| 294 | /* for PLL fix */ |
| 295 | hda_nid_t pll_nid; |
| 296 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 297 | }; |
| 298 | |
| 299 | /* |
| 300 | * configuration template - to be copied to the spec instance |
| 301 | */ |
| 302 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 303 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 304 | * with spec |
| 305 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 306 | const struct hda_verb *init_verbs[5]; |
| 307 | unsigned int num_dacs; |
| 308 | hda_nid_t *dac_nids; |
| 309 | hda_nid_t dig_out_nid; /* optional */ |
| 310 | hda_nid_t hp_nid; /* optional */ |
| 311 | unsigned int num_adc_nids; |
| 312 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 313 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 314 | hda_nid_t dig_in_nid; |
| 315 | unsigned int num_channel_mode; |
| 316 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 317 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 318 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 319 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 320 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 321 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 322 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 323 | struct hda_amp_list *loopbacks; |
| 324 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | }; |
| 326 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | |
| 328 | /* |
| 329 | * input MUX handling |
| 330 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 331 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 332 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | { |
| 334 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 335 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 336 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 337 | if (mux_idx >= spec->num_mux_defs) |
| 338 | mux_idx = 0; |
| 339 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | } |
| 341 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 342 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 343 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | { |
| 345 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 346 | struct alc_spec *spec = codec->spec; |
| 347 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 348 | |
| 349 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 350 | return 0; |
| 351 | } |
| 352 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 353 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 354 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | { |
| 356 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 357 | struct alc_spec *spec = codec->spec; |
| 358 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 359 | 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] | 360 | hda_nid_t nid = spec->capsrc_nids ? |
| 361 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 362 | 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] | 363 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | } |
| 365 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 366 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | /* |
| 368 | * channel mode setting |
| 369 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 370 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 371 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | { |
| 373 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 374 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 375 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 376 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | } |
| 378 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 379 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 380 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | { |
| 382 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 383 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 384 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 385 | spec->num_channel_mode, |
| 386 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | } |
| 388 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 389 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 390 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 391 | { |
| 392 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 393 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 394 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 395 | spec->num_channel_mode, |
| 396 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 397 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 398 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 399 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | } |
| 401 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 403 | * 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] | 404 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 405 | * being part of a format specifier. Maximum allowed length of a value is |
| 406 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 407 | * |
| 408 | * Note: some retasking pin complexes seem to ignore requests for input |
| 409 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 410 | * are requested. Therefore order this list so that this behaviour will not |
| 411 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 412 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 413 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 414 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 415 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 416 | "Mic 50pc bias", "Mic 80pc bias", |
| 417 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 418 | }; |
| 419 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 420 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 421 | }; |
| 422 | /* 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] | 423 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 424 | * addition, "input" pins may or may not process the mic bias option |
| 425 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 426 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 427 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 428 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 429 | #define ALC_PIN_DIR_IN 0x00 |
| 430 | #define ALC_PIN_DIR_OUT 0x01 |
| 431 | #define ALC_PIN_DIR_INOUT 0x02 |
| 432 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 433 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 434 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 435 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 436 | * For each direction the minimum and maximum values are given. |
| 437 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 438 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 439 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 440 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 441 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 442 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 443 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 444 | }; |
| 445 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 446 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 447 | #define alc_pin_mode_n_items(_dir) \ |
| 448 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 449 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 450 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 451 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 452 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 453 | unsigned int item_num = uinfo->value.enumerated.item; |
| 454 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 455 | |
| 456 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 457 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 458 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 459 | |
| 460 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 461 | item_num = alc_pin_mode_min(dir); |
| 462 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 463 | return 0; |
| 464 | } |
| 465 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 466 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 467 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 468 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 469 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 470 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 471 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 472 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 473 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 474 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 475 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 476 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 477 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 478 | /* Find enumerated value for current pinctl setting */ |
| 479 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 480 | 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] | 481 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 482 | *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] | 483 | return 0; |
| 484 | } |
| 485 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 486 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 487 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 488 | { |
| 489 | signed int change; |
| 490 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 491 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 492 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 493 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 494 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 495 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 496 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 497 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 498 | 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] | 499 | val = alc_pin_mode_min(dir); |
| 500 | |
| 501 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 502 | if (change) { |
| 503 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 504 | snd_hda_codec_write_cache(codec, nid, 0, |
| 505 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 506 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 507 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 508 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 509 | * for the requested pin mode. Enum values of 2 or less are |
| 510 | * input modes. |
| 511 | * |
| 512 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 513 | * reduces noise slightly (particularly on input) so we'll |
| 514 | * do it. However, having both input and output buffers |
| 515 | * enabled simultaneously doesn't seem to be problematic if |
| 516 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 517 | */ |
| 518 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 519 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 520 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 521 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 522 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 523 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 524 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 525 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 526 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 527 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 528 | } |
| 529 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 530 | return change; |
| 531 | } |
| 532 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 533 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 534 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 535 | .info = alc_pin_mode_info, \ |
| 536 | .get = alc_pin_mode_get, \ |
| 537 | .put = alc_pin_mode_put, \ |
| 538 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 539 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 540 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 541 | * together using a mask with more than one bit set. This control is |
| 542 | * currently used only by the ALC260 test model. At this stage they are not |
| 543 | * needed for any "production" models. |
| 544 | */ |
| 545 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 546 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 547 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 548 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 549 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 550 | { |
| 551 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 552 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 553 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 554 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 555 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 556 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 557 | |
| 558 | *valp = (val & mask) != 0; |
| 559 | return 0; |
| 560 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 561 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 562 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 563 | { |
| 564 | signed int change; |
| 565 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 566 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 567 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 568 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 569 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 570 | AC_VERB_GET_GPIO_DATA, |
| 571 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 572 | |
| 573 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 574 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 575 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 576 | gpio_data &= ~mask; |
| 577 | else |
| 578 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 579 | snd_hda_codec_write_cache(codec, nid, 0, |
| 580 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 581 | |
| 582 | return change; |
| 583 | } |
| 584 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 585 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 586 | .info = alc_gpio_data_info, \ |
| 587 | .get = alc_gpio_data_get, \ |
| 588 | .put = alc_gpio_data_put, \ |
| 589 | .private_value = nid | (mask<<16) } |
| 590 | #endif /* CONFIG_SND_DEBUG */ |
| 591 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 592 | /* A switch control to allow the enabling of the digital IO pins on the |
| 593 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 594 | * to provide something in the test model allowing digital outputs to be |
| 595 | * identified if present. If models are found which can utilise these |
| 596 | * outputs a more complete mixer control can be devised for those models if |
| 597 | * necessary. |
| 598 | */ |
| 599 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 600 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 601 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 602 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 603 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 604 | { |
| 605 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 606 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 607 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 608 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 609 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 610 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 611 | |
| 612 | *valp = (val & mask) != 0; |
| 613 | return 0; |
| 614 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 615 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 616 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 617 | { |
| 618 | signed int change; |
| 619 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 620 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 621 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 622 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 623 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 624 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 625 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 626 | |
| 627 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 628 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 629 | if (val==0) |
| 630 | ctrl_data &= ~mask; |
| 631 | else |
| 632 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 633 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 634 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 635 | |
| 636 | return change; |
| 637 | } |
| 638 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 639 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 640 | .info = alc_spdif_ctrl_info, \ |
| 641 | .get = alc_spdif_ctrl_get, \ |
| 642 | .put = alc_spdif_ctrl_put, \ |
| 643 | .private_value = nid | (mask<<16) } |
| 644 | #endif /* CONFIG_SND_DEBUG */ |
| 645 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 646 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 647 | * Again, this is only used in the ALC26x test models to help identify when |
| 648 | * the EAPD line must be asserted for features to work. |
| 649 | */ |
| 650 | #ifdef CONFIG_SND_DEBUG |
| 651 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 652 | |
| 653 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 654 | struct snd_ctl_elem_value *ucontrol) |
| 655 | { |
| 656 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 657 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 658 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 659 | long *valp = ucontrol->value.integer.value; |
| 660 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 661 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 662 | |
| 663 | *valp = (val & mask) != 0; |
| 664 | return 0; |
| 665 | } |
| 666 | |
| 667 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 668 | struct snd_ctl_elem_value *ucontrol) |
| 669 | { |
| 670 | int change; |
| 671 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 672 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 673 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 674 | long val = *ucontrol->value.integer.value; |
| 675 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 676 | AC_VERB_GET_EAPD_BTLENABLE, |
| 677 | 0x00); |
| 678 | |
| 679 | /* Set/unset the masked control bit(s) as needed */ |
| 680 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 681 | if (!val) |
| 682 | ctrl_data &= ~mask; |
| 683 | else |
| 684 | ctrl_data |= mask; |
| 685 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 686 | ctrl_data); |
| 687 | |
| 688 | return change; |
| 689 | } |
| 690 | |
| 691 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 692 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 693 | .info = alc_eapd_ctrl_info, \ |
| 694 | .get = alc_eapd_ctrl_get, \ |
| 695 | .put = alc_eapd_ctrl_put, \ |
| 696 | .private_value = nid | (mask<<16) } |
| 697 | #endif /* CONFIG_SND_DEBUG */ |
| 698 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 699 | /* |
| 700 | * set up from the preset table |
| 701 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 702 | static void setup_preset(struct alc_spec *spec, |
| 703 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 704 | { |
| 705 | int i; |
| 706 | |
| 707 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 708 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 709 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 710 | i++) |
| 711 | spec->init_verbs[spec->num_init_verbs++] = |
| 712 | preset->init_verbs[i]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 713 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 714 | spec->channel_mode = preset->channel_mode; |
| 715 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 716 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 717 | |
| 718 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 719 | |
| 720 | spec->multiout.num_dacs = preset->num_dacs; |
| 721 | spec->multiout.dac_nids = preset->dac_nids; |
| 722 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 723 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 724 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 725 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 726 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 727 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 728 | spec->input_mux = preset->input_mux; |
| 729 | |
| 730 | spec->num_adc_nids = preset->num_adc_nids; |
| 731 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 732 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 733 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 734 | |
| 735 | spec->unsol_event = preset->unsol_event; |
| 736 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 737 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 738 | spec->loopback.amplist = preset->loopbacks; |
| 739 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 740 | } |
| 741 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 742 | /* Enable GPIO mask and set output */ |
| 743 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 744 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 745 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 746 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 747 | { } |
| 748 | }; |
| 749 | |
| 750 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 751 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 752 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 753 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 754 | { } |
| 755 | }; |
| 756 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 757 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 758 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 759 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 760 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 761 | { } |
| 762 | }; |
| 763 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 764 | /* |
| 765 | * Fix hardware PLL issue |
| 766 | * On some codecs, the analog PLL gating control must be off while |
| 767 | * the default value is 1. |
| 768 | */ |
| 769 | static void alc_fix_pll(struct hda_codec *codec) |
| 770 | { |
| 771 | struct alc_spec *spec = codec->spec; |
| 772 | unsigned int val; |
| 773 | |
| 774 | if (!spec->pll_nid) |
| 775 | return; |
| 776 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 777 | spec->pll_coef_idx); |
| 778 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 779 | AC_VERB_GET_PROC_COEF, 0); |
| 780 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 781 | spec->pll_coef_idx); |
| 782 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 783 | val & ~(1 << spec->pll_coef_bit)); |
| 784 | } |
| 785 | |
| 786 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 787 | unsigned int coef_idx, unsigned int coef_bit) |
| 788 | { |
| 789 | struct alc_spec *spec = codec->spec; |
| 790 | spec->pll_nid = nid; |
| 791 | spec->pll_coef_idx = coef_idx; |
| 792 | spec->pll_coef_bit = coef_bit; |
| 793 | alc_fix_pll(codec); |
| 794 | } |
| 795 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 796 | static void alc_sku_automute(struct hda_codec *codec) |
| 797 | { |
| 798 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 799 | unsigned int present; |
| 800 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 801 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 802 | |
| 803 | /* need to execute and sync at first */ |
| 804 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 805 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 806 | AC_VERB_GET_PIN_SENSE, 0); |
| 807 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 808 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 809 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 810 | } |
| 811 | |
| 812 | /* unsolicited event for HP jack sensing */ |
| 813 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 814 | { |
| 815 | if (codec->vendor_id == 0x10ec0880) |
| 816 | res >>= 28; |
| 817 | else |
| 818 | res >>= 26; |
| 819 | if (res != ALC880_HP_EVENT) |
| 820 | return; |
| 821 | |
| 822 | alc_sku_automute(codec); |
| 823 | } |
| 824 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 825 | /* additional initialization for ALC888 variants */ |
| 826 | static void alc888_coef_init(struct hda_codec *codec) |
| 827 | { |
| 828 | unsigned int tmp; |
| 829 | |
| 830 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 831 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 832 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 833 | if ((tmp & 0xf0) == 2) |
| 834 | /* alc888S-VC */ |
| 835 | snd_hda_codec_read(codec, 0x20, 0, |
| 836 | AC_VERB_SET_PROC_COEF, 0x830); |
| 837 | else |
| 838 | /* alc888-VB */ |
| 839 | snd_hda_codec_read(codec, 0x20, 0, |
| 840 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 841 | } |
| 842 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 843 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 844 | * 31 ~ 16 : Manufacture ID |
| 845 | * 15 ~ 8 : SKU ID |
| 846 | * 7 ~ 0 : Assembly ID |
| 847 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 848 | */ |
| 849 | static void alc_subsystem_id(struct hda_codec *codec, |
| 850 | unsigned int porta, unsigned int porte, |
| 851 | unsigned int portd) |
| 852 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 853 | unsigned int ass, tmp, i; |
| 854 | unsigned nid; |
| 855 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 856 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 857 | ass = codec->subsystem_id & 0xffff; |
| 858 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 859 | goto do_sku; |
| 860 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 861 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 862 | * 31~30 : port conetcivity |
| 863 | * 29~21 : reserve |
| 864 | * 20 : PCBEEP input |
| 865 | * 19~16 : Check sum (15:1) |
| 866 | * 15~1 : Custom |
| 867 | * 0 : override |
| 868 | */ |
| 869 | nid = 0x1d; |
| 870 | if (codec->vendor_id == 0x10ec0260) |
| 871 | nid = 0x17; |
| 872 | ass = snd_hda_codec_read(codec, nid, 0, |
| 873 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 874 | if (!(ass & 1) && !(ass & 0x100000)) |
| 875 | return; |
| 876 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 877 | return; |
| 878 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 879 | /* check sum */ |
| 880 | tmp = 0; |
| 881 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 882 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 883 | tmp++; |
| 884 | } |
| 885 | if (((ass >> 16) & 0xf) != tmp) |
| 886 | return; |
| 887 | do_sku: |
| 888 | /* |
| 889 | * 0 : override |
| 890 | * 1 : Swap Jack |
| 891 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 892 | * 3~5 : External Amplifier control |
| 893 | * 7~6 : Reserved |
| 894 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 895 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 896 | switch (tmp) { |
| 897 | case 1: |
| 898 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 899 | break; |
| 900 | case 3: |
| 901 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 902 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 903 | case 7: |
| 904 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 905 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 906 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 907 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 908 | case 0x10ec0260: |
| 909 | snd_hda_codec_write(codec, 0x0f, 0, |
| 910 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 911 | snd_hda_codec_write(codec, 0x10, 0, |
| 912 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 913 | break; |
| 914 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 915 | case 0x10ec0267: |
| 916 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 917 | case 0x10ec0269: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 918 | case 0x10ec0660: |
| 919 | case 0x10ec0662: |
| 920 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 921 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 922 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 923 | snd_hda_codec_write(codec, 0x14, 0, |
| 924 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 925 | snd_hda_codec_write(codec, 0x15, 0, |
| 926 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 927 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 928 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 929 | switch (codec->vendor_id) { |
| 930 | case 0x10ec0260: |
| 931 | snd_hda_codec_write(codec, 0x1a, 0, |
| 932 | AC_VERB_SET_COEF_INDEX, 7); |
| 933 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 934 | AC_VERB_GET_PROC_COEF, 0); |
| 935 | snd_hda_codec_write(codec, 0x1a, 0, |
| 936 | AC_VERB_SET_COEF_INDEX, 7); |
| 937 | snd_hda_codec_write(codec, 0x1a, 0, |
| 938 | AC_VERB_SET_PROC_COEF, |
| 939 | tmp | 0x2010); |
| 940 | break; |
| 941 | case 0x10ec0262: |
| 942 | case 0x10ec0880: |
| 943 | case 0x10ec0882: |
| 944 | case 0x10ec0883: |
| 945 | case 0x10ec0885: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 946 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 947 | snd_hda_codec_write(codec, 0x20, 0, |
| 948 | AC_VERB_SET_COEF_INDEX, 7); |
| 949 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 950 | AC_VERB_GET_PROC_COEF, 0); |
| 951 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 952 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 953 | snd_hda_codec_write(codec, 0x20, 0, |
| 954 | AC_VERB_SET_PROC_COEF, |
| 955 | tmp | 0x2010); |
| 956 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 957 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 958 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 959 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 960 | case 0x10ec0267: |
| 961 | case 0x10ec0268: |
| 962 | snd_hda_codec_write(codec, 0x20, 0, |
| 963 | AC_VERB_SET_COEF_INDEX, 7); |
| 964 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 965 | AC_VERB_GET_PROC_COEF, 0); |
| 966 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 967 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 968 | snd_hda_codec_write(codec, 0x20, 0, |
| 969 | AC_VERB_SET_PROC_COEF, |
| 970 | tmp | 0x3000); |
| 971 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 972 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 973 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 974 | break; |
| 975 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 976 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 977 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 978 | * when the external headphone out jack is plugged" |
| 979 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 980 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 981 | return; |
| 982 | /* |
| 983 | * 10~8 : Jack location |
| 984 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 985 | * 14~13: Resvered |
| 986 | * 15 : 1 --> enable the function "Mute internal speaker |
| 987 | * when the external headphone out jack is plugged" |
| 988 | */ |
| 989 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 990 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 991 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 992 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 993 | else |
| 994 | return; |
| 995 | } |
| 996 | |
| 997 | if (!spec->autocfg.hp_pins[0]) { |
| 998 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 999 | if (tmp == 0) |
| 1000 | spec->autocfg.hp_pins[0] = porta; |
| 1001 | else if (tmp == 1) |
| 1002 | spec->autocfg.hp_pins[0] = porte; |
| 1003 | else if (tmp == 2) |
| 1004 | spec->autocfg.hp_pins[0] = portd; |
| 1005 | else |
| 1006 | return; |
| 1007 | } |
| 1008 | |
| 1009 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1010 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1011 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1012 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1013 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1014 | } |
| 1015 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1016 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1017 | * Fix-up pin default configurations |
| 1018 | */ |
| 1019 | |
| 1020 | struct alc_pincfg { |
| 1021 | hda_nid_t nid; |
| 1022 | u32 val; |
| 1023 | }; |
| 1024 | |
| 1025 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1026 | const struct snd_pci_quirk *quirk, |
| 1027 | const struct alc_pincfg **pinfix) |
| 1028 | { |
| 1029 | const struct alc_pincfg *cfg; |
| 1030 | |
| 1031 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1032 | if (!quirk) |
| 1033 | return; |
| 1034 | |
| 1035 | cfg = pinfix[quirk->value]; |
| 1036 | for (; cfg->nid; cfg++) { |
| 1037 | int i; |
| 1038 | u32 val = cfg->val; |
| 1039 | for (i = 0; i < 4; i++) { |
| 1040 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1041 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1042 | val & 0xff); |
| 1043 | val >>= 8; |
| 1044 | } |
| 1045 | } |
| 1046 | } |
| 1047 | |
| 1048 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1049 | * ALC880 3-stack model |
| 1050 | * |
| 1051 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1052 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1053 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1054 | */ |
| 1055 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1056 | static hda_nid_t alc880_dac_nids[4] = { |
| 1057 | /* front, rear, clfe, rear_surr */ |
| 1058 | 0x02, 0x05, 0x04, 0x03 |
| 1059 | }; |
| 1060 | |
| 1061 | static hda_nid_t alc880_adc_nids[3] = { |
| 1062 | /* ADC0-2 */ |
| 1063 | 0x07, 0x08, 0x09, |
| 1064 | }; |
| 1065 | |
| 1066 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1067 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1068 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1069 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1070 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1071 | /* ADC1-2 */ |
| 1072 | 0x08, 0x09, |
| 1073 | }; |
| 1074 | |
| 1075 | #define ALC880_DIGOUT_NID 0x06 |
| 1076 | #define ALC880_DIGIN_NID 0x0a |
| 1077 | |
| 1078 | static struct hda_input_mux alc880_capture_source = { |
| 1079 | .num_items = 4, |
| 1080 | .items = { |
| 1081 | { "Mic", 0x0 }, |
| 1082 | { "Front Mic", 0x3 }, |
| 1083 | { "Line", 0x2 }, |
| 1084 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1085 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1086 | }; |
| 1087 | |
| 1088 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1089 | /* 2ch mode */ |
| 1090 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1091 | /* set line-in to input, mute it */ |
| 1092 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1093 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1094 | /* set mic-in to input vref 80%, mute it */ |
| 1095 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1096 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1097 | { } /* end */ |
| 1098 | }; |
| 1099 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1100 | /* 6ch mode */ |
| 1101 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1102 | /* set line-in to output, unmute it */ |
| 1103 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1104 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1105 | /* set mic-in to output, unmute it */ |
| 1106 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1107 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1108 | { } /* end */ |
| 1109 | }; |
| 1110 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1111 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1112 | { 2, alc880_threestack_ch2_init }, |
| 1113 | { 6, alc880_threestack_ch6_init }, |
| 1114 | }; |
| 1115 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1116 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1117 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1118 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1119 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1120 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1121 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1122 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1123 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1124 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1125 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1126 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1131 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1132 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1133 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1134 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1135 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1136 | { |
| 1137 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1138 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1139 | .info = alc_ch_mode_info, |
| 1140 | .get = alc_ch_mode_get, |
| 1141 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1142 | }, |
| 1143 | { } /* end */ |
| 1144 | }; |
| 1145 | |
| 1146 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1147 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1148 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1149 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1150 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1151 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1152 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1153 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1154 | { |
| 1155 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1156 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1157 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1158 | */ |
| 1159 | /* .name = "Capture Source", */ |
| 1160 | .name = "Input Source", |
| 1161 | .count = 3, |
| 1162 | .info = alc_mux_enum_info, |
| 1163 | .get = alc_mux_enum_get, |
| 1164 | .put = alc_mux_enum_put, |
| 1165 | }, |
| 1166 | { } /* end */ |
| 1167 | }; |
| 1168 | |
| 1169 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1170 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1171 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1172 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1173 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1174 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1175 | { |
| 1176 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1177 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1178 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1179 | */ |
| 1180 | /* .name = "Capture Source", */ |
| 1181 | .name = "Input Source", |
| 1182 | .count = 2, |
| 1183 | .info = alc_mux_enum_info, |
| 1184 | .get = alc_mux_enum_get, |
| 1185 | .put = alc_mux_enum_put, |
| 1186 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1187 | { } /* end */ |
| 1188 | }; |
| 1189 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1190 | |
| 1191 | |
| 1192 | /* |
| 1193 | * ALC880 5-stack model |
| 1194 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1195 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1196 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1197 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1198 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1199 | */ |
| 1200 | |
| 1201 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1202 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1203 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1204 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1205 | { } /* end */ |
| 1206 | }; |
| 1207 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1208 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1209 | /* 6ch mode */ |
| 1210 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1211 | /* set line-in to input, mute it */ |
| 1212 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1213 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1214 | { } /* end */ |
| 1215 | }; |
| 1216 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1217 | /* 8ch mode */ |
| 1218 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1219 | /* set line-in to output, unmute it */ |
| 1220 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1221 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1222 | { } /* end */ |
| 1223 | }; |
| 1224 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1225 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1226 | { 6, alc880_fivestack_ch6_init }, |
| 1227 | { 8, alc880_fivestack_ch8_init }, |
| 1228 | }; |
| 1229 | |
| 1230 | |
| 1231 | /* |
| 1232 | * ALC880 6-stack model |
| 1233 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1234 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1235 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1236 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1237 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1238 | */ |
| 1239 | |
| 1240 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1241 | /* front, rear, clfe, rear_surr */ |
| 1242 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1243 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1244 | |
| 1245 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1246 | .num_items = 4, |
| 1247 | .items = { |
| 1248 | { "Mic", 0x0 }, |
| 1249 | { "Front Mic", 0x1 }, |
| 1250 | { "Line", 0x2 }, |
| 1251 | { "CD", 0x4 }, |
| 1252 | }, |
| 1253 | }; |
| 1254 | |
| 1255 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1256 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1257 | { 8, NULL }, |
| 1258 | }; |
| 1259 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1260 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1261 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1262 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1263 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1264 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1265 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1266 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1267 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1268 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1269 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1270 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1271 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1272 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1273 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1274 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1275 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1276 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1277 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1278 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1279 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1280 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1281 | { |
| 1282 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1283 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1284 | .info = alc_ch_mode_info, |
| 1285 | .get = alc_ch_mode_get, |
| 1286 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1287 | }, |
| 1288 | { } /* end */ |
| 1289 | }; |
| 1290 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1291 | |
| 1292 | /* |
| 1293 | * ALC880 W810 model |
| 1294 | * |
| 1295 | * W810 has rear IO for: |
| 1296 | * Front (DAC 02) |
| 1297 | * Surround (DAC 03) |
| 1298 | * Center/LFE (DAC 04) |
| 1299 | * Digital out (06) |
| 1300 | * |
| 1301 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1302 | * 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] | 1303 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1304 | * There is a variable resistor to control the speaker or headphone |
| 1305 | * volume. This is a hardware-only device without a software API. |
| 1306 | * |
| 1307 | * Plugging headphones in will disable the internal speakers. This is |
| 1308 | * implemented in hardware, not via the driver using jack sense. In |
| 1309 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1310 | * disable both the speakers and headphones. |
| 1311 | * |
| 1312 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1313 | * These may not do anything useful with this driver yet, because I |
| 1314 | * haven't setup any initialization verbs for these yet... |
| 1315 | */ |
| 1316 | |
| 1317 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1318 | /* front, rear/surround, clfe */ |
| 1319 | 0x02, 0x03, 0x04 |
| 1320 | }; |
| 1321 | |
| 1322 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1323 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1324 | { 6, NULL } |
| 1325 | }; |
| 1326 | |
| 1327 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1328 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1329 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1330 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1331 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1332 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1333 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1334 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1335 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1336 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1337 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1338 | { } /* end */ |
| 1339 | }; |
| 1340 | |
| 1341 | |
| 1342 | /* |
| 1343 | * Z710V model |
| 1344 | * |
| 1345 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1346 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1347 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1348 | */ |
| 1349 | |
| 1350 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1351 | 0x02 |
| 1352 | }; |
| 1353 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1354 | |
| 1355 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1356 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1357 | { 2, NULL } |
| 1358 | }; |
| 1359 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1360 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1361 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1362 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1363 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1364 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1365 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1366 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1367 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1368 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1369 | { } /* end */ |
| 1370 | }; |
| 1371 | |
| 1372 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1373 | /* |
| 1374 | * ALC880 F1734 model |
| 1375 | * |
| 1376 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1377 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1378 | */ |
| 1379 | |
| 1380 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1381 | 0x03 |
| 1382 | }; |
| 1383 | #define ALC880_F1734_HP_DAC 0x02 |
| 1384 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1385 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1386 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1387 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1388 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1389 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1390 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1391 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1392 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1393 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1394 | { } /* end */ |
| 1395 | }; |
| 1396 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1397 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1398 | .num_items = 2, |
| 1399 | .items = { |
| 1400 | { "Mic", 0x1 }, |
| 1401 | { "CD", 0x4 }, |
| 1402 | }, |
| 1403 | }; |
| 1404 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1405 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1406 | /* |
| 1407 | * ALC880 ASUS model |
| 1408 | * |
| 1409 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1410 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1411 | * Mic = 0x18, Line = 0x1a |
| 1412 | */ |
| 1413 | |
| 1414 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1415 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1416 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1417 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1418 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1419 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1420 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1421 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1422 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1423 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1424 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1425 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1426 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1427 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1428 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1429 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1431 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1432 | { |
| 1433 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1434 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1435 | .info = alc_ch_mode_info, |
| 1436 | .get = alc_ch_mode_get, |
| 1437 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1438 | }, |
| 1439 | { } /* end */ |
| 1440 | }; |
| 1441 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1442 | /* |
| 1443 | * ALC880 ASUS W1V model |
| 1444 | * |
| 1445 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1446 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1447 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1448 | */ |
| 1449 | |
| 1450 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1451 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1452 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1453 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1454 | { } /* end */ |
| 1455 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1456 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1457 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1458 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1459 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1460 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1461 | { } /* end */ |
| 1462 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1463 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1464 | /* TCL S700 */ |
| 1465 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1466 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1467 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1468 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1469 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1470 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1471 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1472 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1473 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1474 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1475 | { |
| 1476 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1477 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1478 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1479 | */ |
| 1480 | /* .name = "Capture Source", */ |
| 1481 | .name = "Input Source", |
| 1482 | .count = 1, |
| 1483 | .info = alc_mux_enum_info, |
| 1484 | .get = alc_mux_enum_get, |
| 1485 | .put = alc_mux_enum_put, |
| 1486 | }, |
| 1487 | { } /* end */ |
| 1488 | }; |
| 1489 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1490 | /* Uniwill */ |
| 1491 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1492 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1493 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1494 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1495 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1496 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1497 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1498 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1499 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1500 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1501 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1502 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1503 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1504 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1505 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1506 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1507 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1508 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1509 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1510 | { |
| 1511 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1512 | .name = "Channel Mode", |
| 1513 | .info = alc_ch_mode_info, |
| 1514 | .get = alc_ch_mode_get, |
| 1515 | .put = alc_ch_mode_put, |
| 1516 | }, |
| 1517 | { } /* end */ |
| 1518 | }; |
| 1519 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1520 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1521 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1522 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1523 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1524 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1525 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1526 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1527 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1528 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1529 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1530 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1531 | { } /* end */ |
| 1532 | }; |
| 1533 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1534 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1535 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1536 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1537 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1538 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1539 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1540 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1541 | { } /* end */ |
| 1542 | }; |
| 1543 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1544 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1545 | * virtual master controls |
| 1546 | */ |
| 1547 | |
| 1548 | /* |
| 1549 | * slave controls for virtual master |
| 1550 | */ |
| 1551 | static const char *alc_slave_vols[] = { |
| 1552 | "Front Playback Volume", |
| 1553 | "Surround Playback Volume", |
| 1554 | "Center Playback Volume", |
| 1555 | "LFE Playback Volume", |
| 1556 | "Side Playback Volume", |
| 1557 | "Headphone Playback Volume", |
| 1558 | "Speaker Playback Volume", |
| 1559 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1560 | "Line-Out Playback Volume", |
| 1561 | NULL, |
| 1562 | }; |
| 1563 | |
| 1564 | static const char *alc_slave_sws[] = { |
| 1565 | "Front Playback Switch", |
| 1566 | "Surround Playback Switch", |
| 1567 | "Center Playback Switch", |
| 1568 | "LFE Playback Switch", |
| 1569 | "Side Playback Switch", |
| 1570 | "Headphone Playback Switch", |
| 1571 | "Speaker Playback Switch", |
| 1572 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1573 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1574 | NULL, |
| 1575 | }; |
| 1576 | |
| 1577 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1578 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1579 | */ |
| 1580 | static int alc_build_controls(struct hda_codec *codec) |
| 1581 | { |
| 1582 | struct alc_spec *spec = codec->spec; |
| 1583 | int err; |
| 1584 | int i; |
| 1585 | |
| 1586 | for (i = 0; i < spec->num_mixers; i++) { |
| 1587 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1588 | if (err < 0) |
| 1589 | return err; |
| 1590 | } |
| 1591 | |
| 1592 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1593 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1594 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1595 | if (err < 0) |
| 1596 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1597 | err = snd_hda_create_spdif_share_sw(codec, |
| 1598 | &spec->multiout); |
| 1599 | if (err < 0) |
| 1600 | return err; |
| 1601 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1602 | } |
| 1603 | if (spec->dig_in_nid) { |
| 1604 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1605 | if (err < 0) |
| 1606 | return err; |
| 1607 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1608 | |
| 1609 | /* if we have no master control, let's create it */ |
| 1610 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1611 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1612 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1613 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1614 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1615 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1616 | if (err < 0) |
| 1617 | return err; |
| 1618 | } |
| 1619 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1620 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1621 | NULL, alc_slave_sws); |
| 1622 | if (err < 0) |
| 1623 | return err; |
| 1624 | } |
| 1625 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1626 | return 0; |
| 1627 | } |
| 1628 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1629 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1630 | /* |
| 1631 | * initialize the codec volumes, etc |
| 1632 | */ |
| 1633 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1634 | /* |
| 1635 | * generic initialization of ADC, input mixers and output mixers |
| 1636 | */ |
| 1637 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1638 | /* |
| 1639 | * Unmute ADC0-2 and set the default input to mic-in |
| 1640 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1641 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1642 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1643 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1644 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1645 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1646 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1647 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1648 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1649 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1650 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1651 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1652 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1653 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1654 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1655 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1656 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1657 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1658 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1659 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1660 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1661 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1662 | /* |
| 1663 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1664 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1665 | /* set vol=0 to output mixers */ |
| 1666 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1667 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1668 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1669 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1670 | /* set up input amps for analog loopback */ |
| 1671 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1672 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1673 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1674 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1675 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1676 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1677 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1678 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1679 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1680 | |
| 1681 | { } |
| 1682 | }; |
| 1683 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1684 | /* |
| 1685 | * 3-stack pin configuration: |
| 1686 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1687 | */ |
| 1688 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1689 | /* |
| 1690 | * preset connection lists of input pins |
| 1691 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1692 | */ |
| 1693 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1694 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1695 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1696 | |
| 1697 | /* |
| 1698 | * Set pin mode and muting |
| 1699 | */ |
| 1700 | /* set front pin widgets 0x14 for output */ |
| 1701 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1702 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1703 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1704 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1705 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1706 | /* Mic2 (as headphone out) for HP output */ |
| 1707 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1708 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1709 | /* Line In pin widget for input */ |
| 1710 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1711 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1712 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1713 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1714 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1715 | /* CD pin widget for input */ |
| 1716 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1717 | |
| 1718 | { } |
| 1719 | }; |
| 1720 | |
| 1721 | /* |
| 1722 | * 5-stack pin configuration: |
| 1723 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1724 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1725 | */ |
| 1726 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1727 | /* |
| 1728 | * preset connection lists of input pins |
| 1729 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1730 | */ |
| 1731 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1732 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1733 | |
| 1734 | /* |
| 1735 | * Set pin mode and muting |
| 1736 | */ |
| 1737 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1738 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1739 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1740 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1741 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1742 | /* unmute pins for output (no gain on this amp) */ |
| 1743 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1744 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1745 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1746 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1747 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1748 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1749 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1750 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1751 | /* Mic2 (as headphone out) for HP output */ |
| 1752 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1753 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1754 | /* Line In pin widget for input */ |
| 1755 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1756 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1757 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1758 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1759 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1760 | /* CD pin widget for input */ |
| 1761 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1762 | |
| 1763 | { } |
| 1764 | }; |
| 1765 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1766 | /* |
| 1767 | * W810 pin configuration: |
| 1768 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1769 | */ |
| 1770 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1771 | /* hphone/speaker input selector: front DAC */ |
| 1772 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1773 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1774 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1775 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1776 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1777 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1778 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1779 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1780 | |
| 1781 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1782 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1783 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1784 | { } |
| 1785 | }; |
| 1786 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1787 | /* |
| 1788 | * Z71V pin configuration: |
| 1789 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1790 | */ |
| 1791 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1792 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1793 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1794 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1795 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1796 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1797 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1798 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1799 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1800 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1801 | |
| 1802 | { } |
| 1803 | }; |
| 1804 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1805 | /* |
| 1806 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1807 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1808 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1809 | */ |
| 1810 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1811 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1812 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1813 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1814 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1815 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1816 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1817 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1818 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1819 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1820 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1821 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1822 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1823 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1824 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1825 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1826 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1827 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1828 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1829 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1830 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1831 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1832 | { } |
| 1833 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1834 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1835 | /* |
| 1836 | * Uniwill pin configuration: |
| 1837 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1838 | * line = 0x1a |
| 1839 | */ |
| 1840 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1841 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1842 | |
| 1843 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1844 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1845 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1846 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1847 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1848 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1849 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1850 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1851 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1852 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1853 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1854 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1855 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1856 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1857 | |
| 1858 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1859 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1860 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1861 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1862 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1863 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1864 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1865 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1866 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1867 | |
| 1868 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1869 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1870 | |
| 1871 | { } |
| 1872 | }; |
| 1873 | |
| 1874 | /* |
| 1875 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1876 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1877 | */ |
| 1878 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1879 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1880 | |
| 1881 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1882 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1883 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1884 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1885 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1886 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1887 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1889 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1890 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1891 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1892 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1893 | |
| 1894 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1895 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1896 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1897 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1898 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1899 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1900 | |
| 1901 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1902 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1903 | |
| 1904 | { } |
| 1905 | }; |
| 1906 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1907 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1908 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1909 | { } |
| 1910 | }; |
| 1911 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1912 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1913 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1914 | { |
| 1915 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1916 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1917 | |
| 1918 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1919 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1920 | bits = present ? HDA_AMP_MUTE : 0; |
| 1921 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1922 | HDA_AMP_MUTE, bits); |
| 1923 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1924 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1925 | } |
| 1926 | |
| 1927 | /* auto-toggle front mic */ |
| 1928 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1929 | { |
| 1930 | unsigned int present; |
| 1931 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1932 | |
| 1933 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1934 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1935 | bits = present ? HDA_AMP_MUTE : 0; |
| 1936 | 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] | 1937 | } |
| 1938 | |
| 1939 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1940 | { |
| 1941 | alc880_uniwill_hp_automute(codec); |
| 1942 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1943 | } |
| 1944 | |
| 1945 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1946 | unsigned int res) |
| 1947 | { |
| 1948 | /* Looks like the unsol event is incompatible with the standard |
| 1949 | * definition. 4bit tag is placed at 28 bit! |
| 1950 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1951 | switch (res >> 28) { |
| 1952 | case ALC880_HP_EVENT: |
| 1953 | alc880_uniwill_hp_automute(codec); |
| 1954 | break; |
| 1955 | case ALC880_MIC_EVENT: |
| 1956 | alc880_uniwill_mic_automute(codec); |
| 1957 | break; |
| 1958 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1959 | } |
| 1960 | |
| 1961 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1962 | { |
| 1963 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1964 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1965 | |
| 1966 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1967 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1968 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 1969 | 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] | 1970 | } |
| 1971 | |
| 1972 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1973 | { |
| 1974 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1975 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1976 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1977 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1978 | present &= HDA_AMP_VOLMASK; |
| 1979 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1980 | HDA_AMP_VOLMASK, present); |
| 1981 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1982 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1983 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1984 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1985 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1986 | unsigned int res) |
| 1987 | { |
| 1988 | /* Looks like the unsol event is incompatible with the standard |
| 1989 | * definition. 4bit tag is placed at 28 bit! |
| 1990 | */ |
| 1991 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1992 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1993 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1994 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1995 | } |
| 1996 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1997 | /* |
| 1998 | * F1734 pin configuration: |
| 1999 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2000 | */ |
| 2001 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2002 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2003 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2004 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2005 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2006 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2007 | |
| 2008 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2009 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2010 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2011 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2012 | |
| 2013 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2014 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2015 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2016 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2017 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2018 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2019 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2020 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2021 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2022 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2023 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2024 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2025 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2026 | { } |
| 2027 | }; |
| 2028 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2029 | /* |
| 2030 | * ASUS pin configuration: |
| 2031 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2032 | */ |
| 2033 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2034 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2035 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2036 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2037 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2038 | |
| 2039 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2040 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2041 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2042 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2043 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2044 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2045 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2046 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2047 | |
| 2048 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2049 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2050 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2051 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2052 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2053 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2054 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2055 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2056 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2057 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2058 | { } |
| 2059 | }; |
| 2060 | |
| 2061 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2062 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2063 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2064 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2065 | /* Clevo m520g init */ |
| 2066 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2067 | /* headphone output */ |
| 2068 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2069 | /* line-out */ |
| 2070 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2071 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2072 | /* Line-in */ |
| 2073 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2074 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2075 | /* CD */ |
| 2076 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2077 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2078 | /* Mic1 (rear panel) */ |
| 2079 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2080 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2081 | /* Mic2 (front panel) */ |
| 2082 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2083 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2084 | /* headphone */ |
| 2085 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2086 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2087 | /* change to EAPD mode */ |
| 2088 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2089 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2090 | |
| 2091 | { } |
| 2092 | }; |
| 2093 | |
| 2094 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2095 | /* change to EAPD mode */ |
| 2096 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2097 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2098 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2099 | /* Headphone output */ |
| 2100 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2101 | /* Front output*/ |
| 2102 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2103 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2104 | |
| 2105 | /* Line In pin widget for input */ |
| 2106 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2107 | /* CD pin widget for input */ |
| 2108 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2109 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2110 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2111 | |
| 2112 | /* change to EAPD mode */ |
| 2113 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2114 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2115 | |
| 2116 | { } |
| 2117 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2118 | |
| 2119 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2120 | * LG m1 express dual |
| 2121 | * |
| 2122 | * Pin assignment: |
| 2123 | * Rear Line-In/Out (blue): 0x14 |
| 2124 | * Build-in Mic-In: 0x15 |
| 2125 | * Speaker-out: 0x17 |
| 2126 | * HP-Out (green): 0x1b |
| 2127 | * Mic-In/Out (red): 0x19 |
| 2128 | * SPDIF-Out: 0x1e |
| 2129 | */ |
| 2130 | |
| 2131 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2132 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2133 | 0x05, 0x02, 0x03 |
| 2134 | }; |
| 2135 | |
| 2136 | /* seems analog CD is not working */ |
| 2137 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2138 | .num_items = 3, |
| 2139 | .items = { |
| 2140 | { "Mic", 0x1 }, |
| 2141 | { "Line", 0x5 }, |
| 2142 | { "Internal Mic", 0x6 }, |
| 2143 | }, |
| 2144 | }; |
| 2145 | |
| 2146 | /* 2,4,6 channel modes */ |
| 2147 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2148 | /* set line-in and mic-in to input */ |
| 2149 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2150 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2151 | { } |
| 2152 | }; |
| 2153 | |
| 2154 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2155 | /* set line-in to out and mic-in to input */ |
| 2156 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2157 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2158 | { } |
| 2159 | }; |
| 2160 | |
| 2161 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2162 | /* set line-in and mic-in to output */ |
| 2163 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2164 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2165 | { } |
| 2166 | }; |
| 2167 | |
| 2168 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2169 | { 2, alc880_lg_ch2_init }, |
| 2170 | { 4, alc880_lg_ch4_init }, |
| 2171 | { 6, alc880_lg_ch6_init }, |
| 2172 | }; |
| 2173 | |
| 2174 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2175 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2176 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2177 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2178 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2179 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2180 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2181 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2182 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2183 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2184 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2185 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2186 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2187 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2188 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2189 | { |
| 2190 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2191 | .name = "Channel Mode", |
| 2192 | .info = alc_ch_mode_info, |
| 2193 | .get = alc_ch_mode_get, |
| 2194 | .put = alc_ch_mode_put, |
| 2195 | }, |
| 2196 | { } /* end */ |
| 2197 | }; |
| 2198 | |
| 2199 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2200 | /* set capture source to mic-in */ |
| 2201 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2202 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2203 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2204 | /* mute all amp mixer inputs */ |
| 2205 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2206 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2207 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2208 | /* line-in to input */ |
| 2209 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2210 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2211 | /* built-in mic */ |
| 2212 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2213 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2214 | /* speaker-out */ |
| 2215 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2216 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2217 | /* mic-in to input */ |
| 2218 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2219 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2220 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2221 | /* HP-out */ |
| 2222 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2223 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2224 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2225 | /* jack sense */ |
| 2226 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2227 | { } |
| 2228 | }; |
| 2229 | |
| 2230 | /* toggle speaker-output according to the hp-jack state */ |
| 2231 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2232 | { |
| 2233 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2234 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2235 | |
| 2236 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2237 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2238 | bits = present ? HDA_AMP_MUTE : 0; |
| 2239 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2240 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2241 | } |
| 2242 | |
| 2243 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2244 | { |
| 2245 | /* Looks like the unsol event is incompatible with the standard |
| 2246 | * definition. 4bit tag is placed at 28 bit! |
| 2247 | */ |
| 2248 | if ((res >> 28) == 0x01) |
| 2249 | alc880_lg_automute(codec); |
| 2250 | } |
| 2251 | |
| 2252 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2253 | * LG LW20 |
| 2254 | * |
| 2255 | * Pin assignment: |
| 2256 | * Speaker-out: 0x14 |
| 2257 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2258 | * Built-in Mic-In: 0x19 |
| 2259 | * Line-In: 0x1b |
| 2260 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2261 | * SPDIF-Out: 0x1e |
| 2262 | */ |
| 2263 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2264 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2265 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2266 | .items = { |
| 2267 | { "Mic", 0x0 }, |
| 2268 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2269 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2270 | }, |
| 2271 | }; |
| 2272 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2273 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2274 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2275 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2276 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2277 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2278 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2279 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2280 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2281 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2282 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2283 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2284 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2285 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2286 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2287 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2288 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2289 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2290 | { |
| 2291 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2292 | .name = "Channel Mode", |
| 2293 | .info = alc_ch_mode_info, |
| 2294 | .get = alc_ch_mode_get, |
| 2295 | .put = alc_ch_mode_put, |
| 2296 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2297 | { } /* end */ |
| 2298 | }; |
| 2299 | |
| 2300 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2301 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2302 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2303 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2304 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2305 | /* set capture source to mic-in */ |
| 2306 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2307 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2308 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2309 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2310 | /* speaker-out */ |
| 2311 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2312 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2313 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2314 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2315 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2316 | /* mic-in to input */ |
| 2317 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2318 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2319 | /* built-in mic */ |
| 2320 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2321 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2322 | /* jack sense */ |
| 2323 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2324 | { } |
| 2325 | }; |
| 2326 | |
| 2327 | /* toggle speaker-output according to the hp-jack state */ |
| 2328 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2329 | { |
| 2330 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2331 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2332 | |
| 2333 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2334 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2335 | bits = present ? HDA_AMP_MUTE : 0; |
| 2336 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2337 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2338 | } |
| 2339 | |
| 2340 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2341 | { |
| 2342 | /* Looks like the unsol event is incompatible with the standard |
| 2343 | * definition. 4bit tag is placed at 28 bit! |
| 2344 | */ |
| 2345 | if ((res >> 28) == 0x01) |
| 2346 | alc880_lg_lw_automute(codec); |
| 2347 | } |
| 2348 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2349 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2350 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2351 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2352 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2353 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2354 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2355 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2356 | { } /* end */ |
| 2357 | }; |
| 2358 | |
| 2359 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2360 | .num_items = 2, |
| 2361 | .items = { |
| 2362 | { "Mic", 0x0 }, |
| 2363 | { "Internal Mic", 0x1 }, |
| 2364 | }, |
| 2365 | }; |
| 2366 | |
| 2367 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2368 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2369 | |
| 2370 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2371 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2372 | |
| 2373 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2374 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2375 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2376 | /* Mic2 (as headphone out) for HP output */ |
| 2377 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2378 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2379 | /* Internal Speaker */ |
| 2380 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2381 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2382 | |
| 2383 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2384 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2385 | |
| 2386 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2387 | { } |
| 2388 | }; |
| 2389 | |
| 2390 | /* toggle speaker-output according to the hp-jack state */ |
| 2391 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2392 | { |
| 2393 | unsigned int present; |
| 2394 | unsigned char bits; |
| 2395 | |
| 2396 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2397 | AC_VERB_GET_PIN_SENSE, 0) |
| 2398 | & AC_PINSENSE_PRESENCE; |
| 2399 | bits = present ? HDA_AMP_MUTE : 0; |
| 2400 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2401 | HDA_AMP_MUTE, bits); |
| 2402 | if (present) |
| 2403 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2404 | else |
| 2405 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2406 | } |
| 2407 | |
| 2408 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2409 | unsigned int res) |
| 2410 | { |
| 2411 | /* Looks like the unsol event is incompatible with the standard |
| 2412 | * definition. 4bit tag is placed at 28 bit! |
| 2413 | */ |
| 2414 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2415 | alc880_medion_rim_automute(codec); |
| 2416 | } |
| 2417 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2418 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2419 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2420 | { 0x0b, HDA_INPUT, 0 }, |
| 2421 | { 0x0b, HDA_INPUT, 1 }, |
| 2422 | { 0x0b, HDA_INPUT, 2 }, |
| 2423 | { 0x0b, HDA_INPUT, 3 }, |
| 2424 | { 0x0b, HDA_INPUT, 4 }, |
| 2425 | { } /* end */ |
| 2426 | }; |
| 2427 | |
| 2428 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2429 | { 0x0b, HDA_INPUT, 1 }, |
| 2430 | { 0x0b, HDA_INPUT, 6 }, |
| 2431 | { 0x0b, HDA_INPUT, 7 }, |
| 2432 | { } /* end */ |
| 2433 | }; |
| 2434 | #endif |
| 2435 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2436 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2437 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2438 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2439 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2440 | static int alc_init(struct hda_codec *codec) |
| 2441 | { |
| 2442 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2443 | unsigned int i; |
| 2444 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2445 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2446 | if (codec->vendor_id == 0x10ec0888) |
| 2447 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2448 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2449 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2450 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2451 | |
| 2452 | if (spec->init_hook) |
| 2453 | spec->init_hook(codec); |
| 2454 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2455 | return 0; |
| 2456 | } |
| 2457 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2458 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2459 | { |
| 2460 | struct alc_spec *spec = codec->spec; |
| 2461 | |
| 2462 | if (spec->unsol_event) |
| 2463 | spec->unsol_event(codec, res); |
| 2464 | } |
| 2465 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2466 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2467 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2468 | { |
| 2469 | struct alc_spec *spec = codec->spec; |
| 2470 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2471 | } |
| 2472 | #endif |
| 2473 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2474 | /* |
| 2475 | * Analog playback callbacks |
| 2476 | */ |
| 2477 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2478 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2479 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2480 | { |
| 2481 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2482 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2483 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2484 | } |
| 2485 | |
| 2486 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2487 | struct hda_codec *codec, |
| 2488 | unsigned int stream_tag, |
| 2489 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2490 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2491 | { |
| 2492 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2493 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2494 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2495 | } |
| 2496 | |
| 2497 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2498 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2499 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2500 | { |
| 2501 | struct alc_spec *spec = codec->spec; |
| 2502 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2503 | } |
| 2504 | |
| 2505 | /* |
| 2506 | * Digital out |
| 2507 | */ |
| 2508 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2509 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2510 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2511 | { |
| 2512 | struct alc_spec *spec = codec->spec; |
| 2513 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2514 | } |
| 2515 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2516 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2517 | struct hda_codec *codec, |
| 2518 | unsigned int stream_tag, |
| 2519 | unsigned int format, |
| 2520 | struct snd_pcm_substream *substream) |
| 2521 | { |
| 2522 | struct alc_spec *spec = codec->spec; |
| 2523 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2524 | stream_tag, format, substream); |
| 2525 | } |
| 2526 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2527 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2528 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2529 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2530 | { |
| 2531 | struct alc_spec *spec = codec->spec; |
| 2532 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2533 | } |
| 2534 | |
| 2535 | /* |
| 2536 | * Analog capture |
| 2537 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2538 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2539 | struct hda_codec *codec, |
| 2540 | unsigned int stream_tag, |
| 2541 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2542 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2543 | { |
| 2544 | struct alc_spec *spec = codec->spec; |
| 2545 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2546 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2547 | stream_tag, 0, format); |
| 2548 | return 0; |
| 2549 | } |
| 2550 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2551 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2552 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2553 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2554 | { |
| 2555 | struct alc_spec *spec = codec->spec; |
| 2556 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2557 | snd_hda_codec_cleanup_stream(codec, |
| 2558 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2559 | return 0; |
| 2560 | } |
| 2561 | |
| 2562 | |
| 2563 | /* |
| 2564 | */ |
| 2565 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2566 | .substreams = 1, |
| 2567 | .channels_min = 2, |
| 2568 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2569 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2570 | .ops = { |
| 2571 | .open = alc880_playback_pcm_open, |
| 2572 | .prepare = alc880_playback_pcm_prepare, |
| 2573 | .cleanup = alc880_playback_pcm_cleanup |
| 2574 | }, |
| 2575 | }; |
| 2576 | |
| 2577 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2578 | .substreams = 1, |
| 2579 | .channels_min = 2, |
| 2580 | .channels_max = 2, |
| 2581 | /* NID is set in alc_build_pcms */ |
| 2582 | }; |
| 2583 | |
| 2584 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2585 | .substreams = 1, |
| 2586 | .channels_min = 2, |
| 2587 | .channels_max = 2, |
| 2588 | /* NID is set in alc_build_pcms */ |
| 2589 | }; |
| 2590 | |
| 2591 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2592 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2593 | .channels_min = 2, |
| 2594 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2595 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2596 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2597 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2598 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2599 | }, |
| 2600 | }; |
| 2601 | |
| 2602 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2603 | .substreams = 1, |
| 2604 | .channels_min = 2, |
| 2605 | .channels_max = 2, |
| 2606 | /* NID is set in alc_build_pcms */ |
| 2607 | .ops = { |
| 2608 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2609 | .close = alc880_dig_playback_pcm_close, |
| 2610 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2611 | }, |
| 2612 | }; |
| 2613 | |
| 2614 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2615 | .substreams = 1, |
| 2616 | .channels_min = 2, |
| 2617 | .channels_max = 2, |
| 2618 | /* NID is set in alc_build_pcms */ |
| 2619 | }; |
| 2620 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2621 | /* 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] | 2622 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2623 | .substreams = 0, |
| 2624 | .channels_min = 0, |
| 2625 | .channels_max = 0, |
| 2626 | }; |
| 2627 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2628 | static int alc_build_pcms(struct hda_codec *codec) |
| 2629 | { |
| 2630 | struct alc_spec *spec = codec->spec; |
| 2631 | struct hda_pcm *info = spec->pcm_rec; |
| 2632 | int i; |
| 2633 | |
| 2634 | codec->num_pcms = 1; |
| 2635 | codec->pcm_info = info; |
| 2636 | |
| 2637 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2638 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2639 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 2640 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2641 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2642 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2643 | } |
| 2644 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2645 | if (snd_BUG_ON(!spec->adc_nids)) |
| 2646 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2647 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2648 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2649 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2650 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2651 | if (spec->channel_mode) { |
| 2652 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2653 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2654 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2655 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2656 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2657 | } |
| 2658 | } |
| 2659 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2660 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2661 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2662 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2663 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2664 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2665 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2666 | if (spec->multiout.dig_out_nid && |
| 2667 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2668 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2669 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2670 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2671 | if (spec->dig_in_nid && |
| 2672 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2673 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2674 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2675 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 2676 | /* FIXME: do we need this for all Realtek codec models? */ |
| 2677 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2678 | } |
| 2679 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2680 | /* If the use of more than one ADC is requested for the current |
| 2681 | * model, configure a second analog capture-only PCM. |
| 2682 | */ |
| 2683 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2684 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2685 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2686 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2687 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2688 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2689 | if (spec->alt_dac_nid) { |
| 2690 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2691 | *spec->stream_analog_alt_playback; |
| 2692 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2693 | spec->alt_dac_nid; |
| 2694 | } else { |
| 2695 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2696 | alc_pcm_null_stream; |
| 2697 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2698 | } |
| 2699 | if (spec->num_adc_nids > 1) { |
| 2700 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2701 | *spec->stream_analog_alt_capture; |
| 2702 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2703 | spec->adc_nids[1]; |
| 2704 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2705 | spec->num_adc_nids - 1; |
| 2706 | } else { |
| 2707 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2708 | alc_pcm_null_stream; |
| 2709 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2710 | } |
| 2711 | } |
| 2712 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2713 | return 0; |
| 2714 | } |
| 2715 | |
| 2716 | static void alc_free(struct hda_codec *codec) |
| 2717 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2718 | struct alc_spec *spec = codec->spec; |
| 2719 | unsigned int i; |
| 2720 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2721 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2722 | return; |
| 2723 | |
| 2724 | if (spec->kctl_alloc) { |
| 2725 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2726 | kfree(spec->kctl_alloc[i].name); |
| 2727 | kfree(spec->kctl_alloc); |
| 2728 | } |
| 2729 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2730 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2731 | } |
| 2732 | |
| 2733 | /* |
| 2734 | */ |
| 2735 | static struct hda_codec_ops alc_patch_ops = { |
| 2736 | .build_controls = alc_build_controls, |
| 2737 | .build_pcms = alc_build_pcms, |
| 2738 | .init = alc_init, |
| 2739 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2740 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2741 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2742 | .check_power_status = alc_check_power_status, |
| 2743 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2744 | }; |
| 2745 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2746 | |
| 2747 | /* |
| 2748 | * Test configuration for debugging |
| 2749 | * |
| 2750 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2751 | * enum controls. |
| 2752 | */ |
| 2753 | #ifdef CONFIG_SND_DEBUG |
| 2754 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2755 | 0x02, 0x03, 0x04, 0x05 |
| 2756 | }; |
| 2757 | |
| 2758 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2759 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2760 | .items = { |
| 2761 | { "In-1", 0x0 }, |
| 2762 | { "In-2", 0x1 }, |
| 2763 | { "In-3", 0x2 }, |
| 2764 | { "In-4", 0x3 }, |
| 2765 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2766 | { "Front", 0x5 }, |
| 2767 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2768 | }, |
| 2769 | }; |
| 2770 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2771 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2772 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2773 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2774 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2775 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2776 | }; |
| 2777 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2778 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2779 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2780 | { |
| 2781 | static char *texts[] = { |
| 2782 | "N/A", "Line Out", "HP Out", |
| 2783 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2784 | }; |
| 2785 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2786 | uinfo->count = 1; |
| 2787 | uinfo->value.enumerated.items = 8; |
| 2788 | if (uinfo->value.enumerated.item >= 8) |
| 2789 | uinfo->value.enumerated.item = 7; |
| 2790 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2791 | return 0; |
| 2792 | } |
| 2793 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2794 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2795 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2796 | { |
| 2797 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2798 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2799 | unsigned int pin_ctl, item = 0; |
| 2800 | |
| 2801 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2802 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2803 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2804 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2805 | item = 2; |
| 2806 | else |
| 2807 | item = 1; |
| 2808 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2809 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2810 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2811 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2812 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2813 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2814 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2815 | } |
| 2816 | } |
| 2817 | ucontrol->value.enumerated.item[0] = item; |
| 2818 | return 0; |
| 2819 | } |
| 2820 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2821 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2822 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2823 | { |
| 2824 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2825 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2826 | static unsigned int ctls[] = { |
| 2827 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2828 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2829 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2830 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2831 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2832 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2833 | }; |
| 2834 | unsigned int old_ctl, new_ctl; |
| 2835 | |
| 2836 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2837 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2838 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2839 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2840 | int val; |
| 2841 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2842 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2843 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2844 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2845 | HDA_AMP_MUTE : 0; |
| 2846 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2847 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2848 | return 1; |
| 2849 | } |
| 2850 | return 0; |
| 2851 | } |
| 2852 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2853 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2854 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2855 | { |
| 2856 | static char *texts[] = { |
| 2857 | "Front", "Surround", "CLFE", "Side" |
| 2858 | }; |
| 2859 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2860 | uinfo->count = 1; |
| 2861 | uinfo->value.enumerated.items = 4; |
| 2862 | if (uinfo->value.enumerated.item >= 4) |
| 2863 | uinfo->value.enumerated.item = 3; |
| 2864 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2865 | return 0; |
| 2866 | } |
| 2867 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2868 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2869 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2870 | { |
| 2871 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2872 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2873 | unsigned int sel; |
| 2874 | |
| 2875 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2876 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2877 | return 0; |
| 2878 | } |
| 2879 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2880 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2881 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2882 | { |
| 2883 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2884 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2885 | unsigned int sel; |
| 2886 | |
| 2887 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2888 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2889 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2890 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2891 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2892 | return 1; |
| 2893 | } |
| 2894 | return 0; |
| 2895 | } |
| 2896 | |
| 2897 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2898 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2899 | .name = xname, \ |
| 2900 | .info = alc_test_pin_ctl_info, \ |
| 2901 | .get = alc_test_pin_ctl_get, \ |
| 2902 | .put = alc_test_pin_ctl_put, \ |
| 2903 | .private_value = nid \ |
| 2904 | } |
| 2905 | |
| 2906 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2907 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2908 | .name = xname, \ |
| 2909 | .info = alc_test_pin_src_info, \ |
| 2910 | .get = alc_test_pin_src_get, \ |
| 2911 | .put = alc_test_pin_src_put, \ |
| 2912 | .private_value = nid \ |
| 2913 | } |
| 2914 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2915 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2916 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2917 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2918 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2919 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2920 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2921 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2922 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2923 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2924 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2925 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2926 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2927 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2928 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2929 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2930 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2931 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2932 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2933 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2934 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2935 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2936 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2937 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2938 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2939 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2940 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2941 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2942 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2943 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2944 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2945 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2946 | { |
| 2947 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2948 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2949 | .info = alc_ch_mode_info, |
| 2950 | .get = alc_ch_mode_get, |
| 2951 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2952 | }, |
| 2953 | { } /* end */ |
| 2954 | }; |
| 2955 | |
| 2956 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2957 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2958 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2959 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2960 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2961 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2962 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2963 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2964 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2965 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2966 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2967 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2968 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2969 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2970 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2971 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2972 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2973 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2974 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2975 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2976 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2977 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2978 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2979 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2980 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2981 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2982 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2983 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2984 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2985 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2986 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2987 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2988 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2989 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2990 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2991 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2992 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2993 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2994 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2995 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2996 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2997 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2998 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2999 | /* Analog input/passthru */ |
| 3000 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3001 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3002 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3003 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3004 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3005 | { } |
| 3006 | }; |
| 3007 | #endif |
| 3008 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3009 | /* |
| 3010 | */ |
| 3011 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3012 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3013 | [ALC880_3ST] = "3stack", |
| 3014 | [ALC880_TCL_S700] = "tcl", |
| 3015 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3016 | [ALC880_CLEVO] = "clevo", |
| 3017 | [ALC880_5ST] = "5stack", |
| 3018 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3019 | [ALC880_W810] = "w810", |
| 3020 | [ALC880_Z71V] = "z71v", |
| 3021 | [ALC880_6ST] = "6stack", |
| 3022 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3023 | [ALC880_ASUS] = "asus", |
| 3024 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3025 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3026 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3027 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3028 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3029 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3030 | [ALC880_F1734] = "F1734", |
| 3031 | [ALC880_LG] = "lg", |
| 3032 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3033 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3034 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3035 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3036 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3037 | [ALC880_AUTO] = "auto", |
| 3038 | }; |
| 3039 | |
| 3040 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3041 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3042 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3043 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3044 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3045 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3046 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3047 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3048 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3049 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3050 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3051 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3052 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3053 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3054 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3055 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3056 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3057 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3058 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3059 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3060 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3061 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3062 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3063 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3064 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3065 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3066 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3067 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3068 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3069 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3070 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3071 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3072 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3073 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3074 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3075 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3076 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3077 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3078 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3079 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3080 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3081 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3082 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3083 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3084 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3085 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3086 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3087 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3088 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3089 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3090 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3091 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3092 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3093 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3094 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3095 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3096 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3097 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3098 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3099 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3100 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3101 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3102 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3103 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3104 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3105 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3106 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3107 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3108 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3109 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3110 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3111 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3112 | {} |
| 3113 | }; |
| 3114 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3115 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3116 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3117 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3118 | static struct alc_config_preset alc880_presets[] = { |
| 3119 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3120 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3121 | .init_verbs = { alc880_volume_init_verbs, |
| 3122 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3123 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3124 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3125 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3126 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3127 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3128 | .input_mux = &alc880_capture_source, |
| 3129 | }, |
| 3130 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3131 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3132 | .init_verbs = { alc880_volume_init_verbs, |
| 3133 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3134 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3135 | .dac_nids = alc880_dac_nids, |
| 3136 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3137 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3138 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3139 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3140 | .input_mux = &alc880_capture_source, |
| 3141 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3142 | [ALC880_TCL_S700] = { |
| 3143 | .mixers = { alc880_tcl_s700_mixer }, |
| 3144 | .init_verbs = { alc880_volume_init_verbs, |
| 3145 | alc880_pin_tcl_S700_init_verbs, |
| 3146 | alc880_gpio2_init_verbs }, |
| 3147 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3148 | .dac_nids = alc880_dac_nids, |
| 3149 | .hp_nid = 0x03, |
| 3150 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3151 | .channel_mode = alc880_2_jack_modes, |
| 3152 | .input_mux = &alc880_capture_source, |
| 3153 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3154 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3155 | .mixers = { alc880_three_stack_mixer, |
| 3156 | alc880_five_stack_mixer}, |
| 3157 | .init_verbs = { alc880_volume_init_verbs, |
| 3158 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3159 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3160 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3161 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3162 | .channel_mode = alc880_fivestack_modes, |
| 3163 | .input_mux = &alc880_capture_source, |
| 3164 | }, |
| 3165 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3166 | .mixers = { alc880_three_stack_mixer, |
| 3167 | alc880_five_stack_mixer }, |
| 3168 | .init_verbs = { alc880_volume_init_verbs, |
| 3169 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3170 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3171 | .dac_nids = alc880_dac_nids, |
| 3172 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3173 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3174 | .channel_mode = alc880_fivestack_modes, |
| 3175 | .input_mux = &alc880_capture_source, |
| 3176 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3177 | [ALC880_6ST] = { |
| 3178 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3179 | .init_verbs = { alc880_volume_init_verbs, |
| 3180 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3181 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3182 | .dac_nids = alc880_6st_dac_nids, |
| 3183 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3184 | .channel_mode = alc880_sixstack_modes, |
| 3185 | .input_mux = &alc880_6stack_capture_source, |
| 3186 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3187 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3188 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3189 | .init_verbs = { alc880_volume_init_verbs, |
| 3190 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3191 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3192 | .dac_nids = alc880_6st_dac_nids, |
| 3193 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3194 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3195 | .channel_mode = alc880_sixstack_modes, |
| 3196 | .input_mux = &alc880_6stack_capture_source, |
| 3197 | }, |
| 3198 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3199 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3200 | .init_verbs = { alc880_volume_init_verbs, |
| 3201 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3202 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3203 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3204 | .dac_nids = alc880_w810_dac_nids, |
| 3205 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3206 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3207 | .channel_mode = alc880_w810_modes, |
| 3208 | .input_mux = &alc880_capture_source, |
| 3209 | }, |
| 3210 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3211 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3212 | .init_verbs = { alc880_volume_init_verbs, |
| 3213 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3214 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3215 | .dac_nids = alc880_z71v_dac_nids, |
| 3216 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3217 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3218 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3219 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3220 | .input_mux = &alc880_capture_source, |
| 3221 | }, |
| 3222 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3223 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3224 | .init_verbs = { alc880_volume_init_verbs, |
| 3225 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3226 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3227 | .dac_nids = alc880_f1734_dac_nids, |
| 3228 | .hp_nid = 0x02, |
| 3229 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3230 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3231 | .input_mux = &alc880_f1734_capture_source, |
| 3232 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3233 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3234 | }, |
| 3235 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3236 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3237 | .init_verbs = { alc880_volume_init_verbs, |
| 3238 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3239 | alc880_gpio1_init_verbs }, |
| 3240 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3241 | .dac_nids = alc880_asus_dac_nids, |
| 3242 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3243 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3244 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3245 | .input_mux = &alc880_capture_source, |
| 3246 | }, |
| 3247 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3248 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3249 | .init_verbs = { alc880_volume_init_verbs, |
| 3250 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3251 | alc880_gpio1_init_verbs }, |
| 3252 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3253 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3254 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3255 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3256 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3257 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3258 | .input_mux = &alc880_capture_source, |
| 3259 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3260 | [ALC880_ASUS_DIG2] = { |
| 3261 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3262 | .init_verbs = { alc880_volume_init_verbs, |
| 3263 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3264 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3265 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3266 | .dac_nids = alc880_asus_dac_nids, |
| 3267 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3268 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3269 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3270 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3271 | .input_mux = &alc880_capture_source, |
| 3272 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3273 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3274 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3275 | .init_verbs = { alc880_volume_init_verbs, |
| 3276 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3277 | alc880_gpio1_init_verbs }, |
| 3278 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3279 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3280 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3281 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3282 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3283 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3284 | .input_mux = &alc880_capture_source, |
| 3285 | }, |
| 3286 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3287 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3288 | .init_verbs = { alc880_volume_init_verbs, |
| 3289 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3290 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3291 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3292 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3293 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3294 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3295 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3296 | .input_mux = &alc880_capture_source, |
| 3297 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3298 | [ALC880_UNIWILL] = { |
| 3299 | .mixers = { alc880_uniwill_mixer }, |
| 3300 | .init_verbs = { alc880_volume_init_verbs, |
| 3301 | alc880_uniwill_init_verbs }, |
| 3302 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3303 | .dac_nids = alc880_asus_dac_nids, |
| 3304 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3305 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3306 | .channel_mode = alc880_threestack_modes, |
| 3307 | .need_dac_fix = 1, |
| 3308 | .input_mux = &alc880_capture_source, |
| 3309 | .unsol_event = alc880_uniwill_unsol_event, |
| 3310 | .init_hook = alc880_uniwill_automute, |
| 3311 | }, |
| 3312 | [ALC880_UNIWILL_P53] = { |
| 3313 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3314 | .init_verbs = { alc880_volume_init_verbs, |
| 3315 | alc880_uniwill_p53_init_verbs }, |
| 3316 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3317 | .dac_nids = alc880_asus_dac_nids, |
| 3318 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3319 | .channel_mode = alc880_threestack_modes, |
| 3320 | .input_mux = &alc880_capture_source, |
| 3321 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3322 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3323 | }, |
| 3324 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3325 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3326 | alc880_pcbeep_mixer, }, |
| 3327 | .init_verbs = { alc880_volume_init_verbs, |
| 3328 | alc880_uniwill_p53_init_verbs, |
| 3329 | alc880_beep_init_verbs }, |
| 3330 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3331 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3332 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3333 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3334 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3335 | .input_mux = &alc880_capture_source, |
| 3336 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3337 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3338 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3339 | [ALC880_CLEVO] = { |
| 3340 | .mixers = { alc880_three_stack_mixer }, |
| 3341 | .init_verbs = { alc880_volume_init_verbs, |
| 3342 | alc880_pin_clevo_init_verbs }, |
| 3343 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3344 | .dac_nids = alc880_dac_nids, |
| 3345 | .hp_nid = 0x03, |
| 3346 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3347 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3348 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3349 | .input_mux = &alc880_capture_source, |
| 3350 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3351 | [ALC880_LG] = { |
| 3352 | .mixers = { alc880_lg_mixer }, |
| 3353 | .init_verbs = { alc880_volume_init_verbs, |
| 3354 | alc880_lg_init_verbs }, |
| 3355 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3356 | .dac_nids = alc880_lg_dac_nids, |
| 3357 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3358 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3359 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3360 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3361 | .input_mux = &alc880_lg_capture_source, |
| 3362 | .unsol_event = alc880_lg_unsol_event, |
| 3363 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3364 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3365 | .loopbacks = alc880_lg_loopbacks, |
| 3366 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3367 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3368 | [ALC880_LG_LW] = { |
| 3369 | .mixers = { alc880_lg_lw_mixer }, |
| 3370 | .init_verbs = { alc880_volume_init_verbs, |
| 3371 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3372 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3373 | .dac_nids = alc880_dac_nids, |
| 3374 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3375 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3376 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3377 | .input_mux = &alc880_lg_lw_capture_source, |
| 3378 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3379 | .init_hook = alc880_lg_lw_automute, |
| 3380 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3381 | [ALC880_MEDION_RIM] = { |
| 3382 | .mixers = { alc880_medion_rim_mixer }, |
| 3383 | .init_verbs = { alc880_volume_init_verbs, |
| 3384 | alc880_medion_rim_init_verbs, |
| 3385 | alc_gpio2_init_verbs }, |
| 3386 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3387 | .dac_nids = alc880_dac_nids, |
| 3388 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3389 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3390 | .channel_mode = alc880_2_jack_modes, |
| 3391 | .input_mux = &alc880_medion_rim_capture_source, |
| 3392 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3393 | .init_hook = alc880_medion_rim_automute, |
| 3394 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3395 | #ifdef CONFIG_SND_DEBUG |
| 3396 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3397 | .mixers = { alc880_test_mixer }, |
| 3398 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3399 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3400 | .dac_nids = alc880_test_dac_nids, |
| 3401 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3402 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3403 | .channel_mode = alc880_test_modes, |
| 3404 | .input_mux = &alc880_test_capture_source, |
| 3405 | }, |
| 3406 | #endif |
| 3407 | }; |
| 3408 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3409 | /* |
| 3410 | * Automatic parse of I/O pins from the BIOS configuration |
| 3411 | */ |
| 3412 | |
| 3413 | #define NUM_CONTROL_ALLOC 32 |
| 3414 | #define NUM_VERB_ALLOC 32 |
| 3415 | |
| 3416 | enum { |
| 3417 | ALC_CTL_WIDGET_VOL, |
| 3418 | ALC_CTL_WIDGET_MUTE, |
| 3419 | ALC_CTL_BIND_MUTE, |
| 3420 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3421 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3422 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3423 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3424 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3425 | }; |
| 3426 | |
| 3427 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3428 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3429 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3430 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3431 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3432 | |
| 3433 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3434 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3435 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3436 | /* array + terminator */ |
| 3437 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3438 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3439 | return -ENOMEM; |
| 3440 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3441 | memcpy(knew, spec->kctl_alloc, |
| 3442 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3443 | kfree(spec->kctl_alloc); |
| 3444 | } |
| 3445 | spec->kctl_alloc = knew; |
| 3446 | spec->num_kctl_alloc = num; |
| 3447 | } |
| 3448 | |
| 3449 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3450 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3451 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3452 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3453 | return -ENOMEM; |
| 3454 | knew->private_value = val; |
| 3455 | spec->num_kctl_used++; |
| 3456 | return 0; |
| 3457 | } |
| 3458 | |
| 3459 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3460 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3461 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3462 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3463 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3464 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3465 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3466 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3467 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3468 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3469 | #define ALC880_PIN_CD_NID 0x1c |
| 3470 | |
| 3471 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3472 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3473 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3474 | { |
| 3475 | hda_nid_t nid; |
| 3476 | int assigned[4]; |
| 3477 | int i, j; |
| 3478 | |
| 3479 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3480 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3481 | |
| 3482 | /* check the pins hardwired to audio widget */ |
| 3483 | for (i = 0; i < cfg->line_outs; i++) { |
| 3484 | nid = cfg->line_out_pins[i]; |
| 3485 | if (alc880_is_fixed_pin(nid)) { |
| 3486 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3487 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3488 | assigned[idx] = 1; |
| 3489 | } |
| 3490 | } |
| 3491 | /* left pins can be connect to any audio widget */ |
| 3492 | for (i = 0; i < cfg->line_outs; i++) { |
| 3493 | nid = cfg->line_out_pins[i]; |
| 3494 | if (alc880_is_fixed_pin(nid)) |
| 3495 | continue; |
| 3496 | /* search for an empty channel */ |
| 3497 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3498 | if (!assigned[j]) { |
| 3499 | spec->multiout.dac_nids[i] = |
| 3500 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3501 | assigned[j] = 1; |
| 3502 | break; |
| 3503 | } |
| 3504 | } |
| 3505 | } |
| 3506 | spec->multiout.num_dacs = cfg->line_outs; |
| 3507 | return 0; |
| 3508 | } |
| 3509 | |
| 3510 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3511 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3512 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3513 | { |
| 3514 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3515 | static const char *chname[4] = { |
| 3516 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3517 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3518 | hda_nid_t nid; |
| 3519 | int i, err; |
| 3520 | |
| 3521 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3522 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3523 | continue; |
| 3524 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3525 | if (i == 2) { |
| 3526 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3527 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3528 | "Center Playback Volume", |
| 3529 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3530 | HDA_OUTPUT)); |
| 3531 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3532 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3533 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3534 | "LFE Playback Volume", |
| 3535 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3536 | HDA_OUTPUT)); |
| 3537 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3538 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3539 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3540 | "Center Playback Switch", |
| 3541 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3542 | HDA_INPUT)); |
| 3543 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3544 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3545 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3546 | "LFE Playback Switch", |
| 3547 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3548 | HDA_INPUT)); |
| 3549 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3550 | return err; |
| 3551 | } else { |
| 3552 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3553 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3554 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3555 | HDA_OUTPUT)); |
| 3556 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3557 | return err; |
| 3558 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3559 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3560 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3561 | HDA_INPUT)); |
| 3562 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3563 | return err; |
| 3564 | } |
| 3565 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3566 | return 0; |
| 3567 | } |
| 3568 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3569 | /* add playback controls for speaker and HP outputs */ |
| 3570 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3571 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3572 | { |
| 3573 | hda_nid_t nid; |
| 3574 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3575 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3576 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3577 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3578 | return 0; |
| 3579 | |
| 3580 | if (alc880_is_fixed_pin(pin)) { |
| 3581 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3582 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3583 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3584 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3585 | else |
| 3586 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3587 | /* control HP volume/switch on the output mixer amp */ |
| 3588 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3589 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3590 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3591 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3592 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3593 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3594 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3595 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3596 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3597 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3598 | return err; |
| 3599 | } else if (alc880_is_multi_pin(pin)) { |
| 3600 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3601 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3602 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3603 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3604 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3605 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3606 | return err; |
| 3607 | } |
| 3608 | return 0; |
| 3609 | } |
| 3610 | |
| 3611 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3612 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3613 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3614 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3615 | { |
| 3616 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3617 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3618 | |
| 3619 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3620 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3621 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3622 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3623 | return err; |
| 3624 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3625 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3626 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3627 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3628 | return err; |
| 3629 | return 0; |
| 3630 | } |
| 3631 | |
| 3632 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3633 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3634 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3635 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3636 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3637 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3638 | |
| 3639 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3640 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3641 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3642 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3643 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3644 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3645 | if (err < 0) |
| 3646 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3647 | imux->items[imux->num_items].label = |
| 3648 | auto_pin_cfg_labels[i]; |
| 3649 | imux->items[imux->num_items].index = |
| 3650 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3651 | imux->num_items++; |
| 3652 | } |
| 3653 | } |
| 3654 | return 0; |
| 3655 | } |
| 3656 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3657 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3658 | unsigned int pin_type) |
| 3659 | { |
| 3660 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3661 | pin_type); |
| 3662 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3663 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3664 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3665 | } |
| 3666 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3667 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3668 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3669 | int dac_idx) |
| 3670 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3671 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3672 | /* need the manual connection? */ |
| 3673 | if (alc880_is_multi_pin(nid)) { |
| 3674 | struct alc_spec *spec = codec->spec; |
| 3675 | int idx = alc880_multi_pin_idx(nid); |
| 3676 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3677 | AC_VERB_SET_CONNECT_SEL, |
| 3678 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3679 | } |
| 3680 | } |
| 3681 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3682 | static int get_pin_type(int line_out_type) |
| 3683 | { |
| 3684 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3685 | return PIN_HP; |
| 3686 | else |
| 3687 | return PIN_OUT; |
| 3688 | } |
| 3689 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3690 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3691 | { |
| 3692 | struct alc_spec *spec = codec->spec; |
| 3693 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3694 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3695 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3696 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3697 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3698 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3699 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3700 | } |
| 3701 | } |
| 3702 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3703 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3704 | { |
| 3705 | struct alc_spec *spec = codec->spec; |
| 3706 | hda_nid_t pin; |
| 3707 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3708 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3709 | if (pin) /* connect to front */ |
| 3710 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3711 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3712 | if (pin) /* connect to front */ |
| 3713 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3714 | } |
| 3715 | |
| 3716 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3717 | { |
| 3718 | struct alc_spec *spec = codec->spec; |
| 3719 | int i; |
| 3720 | |
| 3721 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3722 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3723 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3724 | snd_hda_codec_write(codec, nid, 0, |
| 3725 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3726 | i <= AUTO_PIN_FRONT_MIC ? |
| 3727 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3728 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3729 | snd_hda_codec_write(codec, nid, 0, |
| 3730 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3731 | AMP_OUT_MUTE); |
| 3732 | } |
| 3733 | } |
| 3734 | } |
| 3735 | |
| 3736 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3737 | /* return 1 if successful, 0 if the proper config is not found, |
| 3738 | * or a negative error code |
| 3739 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3740 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3741 | { |
| 3742 | struct alc_spec *spec = codec->spec; |
| 3743 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3744 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3745 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3746 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3747 | alc880_ignore); |
| 3748 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3749 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3750 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3751 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3752 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3753 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3754 | if (err < 0) |
| 3755 | return err; |
| 3756 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3757 | if (err < 0) |
| 3758 | return err; |
| 3759 | err = alc880_auto_create_extra_out(spec, |
| 3760 | spec->autocfg.speaker_pins[0], |
| 3761 | "Speaker"); |
| 3762 | if (err < 0) |
| 3763 | return err; |
| 3764 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3765 | "Headphone"); |
| 3766 | if (err < 0) |
| 3767 | return err; |
| 3768 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3769 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3770 | return err; |
| 3771 | |
| 3772 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3773 | |
| 3774 | if (spec->autocfg.dig_out_pin) |
| 3775 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3776 | if (spec->autocfg.dig_in_pin) |
| 3777 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3778 | |
| 3779 | if (spec->kctl_alloc) |
| 3780 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3781 | |
| 3782 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3783 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3784 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3785 | spec->input_mux = &spec->private_imux; |
| 3786 | |
| 3787 | return 1; |
| 3788 | } |
| 3789 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3790 | /* additional initialization for auto-configuration model */ |
| 3791 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3792 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3793 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3794 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3795 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3796 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3797 | if (spec->unsol_event) |
| 3798 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3799 | } |
| 3800 | |
| 3801 | /* |
| 3802 | * OK, here we have finally the patch for ALC880 |
| 3803 | */ |
| 3804 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3805 | static int patch_alc880(struct hda_codec *codec) |
| 3806 | { |
| 3807 | struct alc_spec *spec; |
| 3808 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3809 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3810 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3811 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3812 | if (spec == NULL) |
| 3813 | return -ENOMEM; |
| 3814 | |
| 3815 | codec->spec = spec; |
| 3816 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3817 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3818 | alc880_models, |
| 3819 | alc880_cfg_tbl); |
| 3820 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3821 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3822 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3823 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3824 | } |
| 3825 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3826 | if (board_config == ALC880_AUTO) { |
| 3827 | /* automatic parse from the BIOS config */ |
| 3828 | err = alc880_parse_auto_config(codec); |
| 3829 | if (err < 0) { |
| 3830 | alc_free(codec); |
| 3831 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3832 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3833 | printk(KERN_INFO |
| 3834 | "hda_codec: Cannot set up configuration " |
| 3835 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3836 | board_config = ALC880_3ST; |
| 3837 | } |
| 3838 | } |
| 3839 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3840 | if (board_config != ALC880_AUTO) |
| 3841 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3842 | |
| 3843 | spec->stream_name_analog = "ALC880 Analog"; |
| 3844 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3845 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3846 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3847 | |
| 3848 | spec->stream_name_digital = "ALC880 Digital"; |
| 3849 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3850 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3851 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3852 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3853 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3854 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3855 | /* get type */ |
| 3856 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3857 | if (wcap != AC_WID_AUD_IN) { |
| 3858 | spec->adc_nids = alc880_adc_nids_alt; |
| 3859 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3860 | spec->mixers[spec->num_mixers] = |
| 3861 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3862 | spec->num_mixers++; |
| 3863 | } else { |
| 3864 | spec->adc_nids = alc880_adc_nids; |
| 3865 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3866 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3867 | spec->num_mixers++; |
| 3868 | } |
| 3869 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3870 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3871 | spec->vmaster_nid = 0x0c; |
| 3872 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3873 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3874 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3875 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3876 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3877 | if (!spec->loopback.amplist) |
| 3878 | spec->loopback.amplist = alc880_loopbacks; |
| 3879 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3880 | |
| 3881 | return 0; |
| 3882 | } |
| 3883 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3884 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3885 | /* |
| 3886 | * ALC260 support |
| 3887 | */ |
| 3888 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3889 | static hda_nid_t alc260_dac_nids[1] = { |
| 3890 | /* front */ |
| 3891 | 0x02, |
| 3892 | }; |
| 3893 | |
| 3894 | static hda_nid_t alc260_adc_nids[1] = { |
| 3895 | /* ADC0 */ |
| 3896 | 0x04, |
| 3897 | }; |
| 3898 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3899 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3900 | /* ADC1 */ |
| 3901 | 0x05, |
| 3902 | }; |
| 3903 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3904 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3905 | /* ADC1, 0 */ |
| 3906 | 0x05, 0x04 |
| 3907 | }; |
| 3908 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3909 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3910 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3911 | */ |
| 3912 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3913 | /* ADC0, ADC1 */ |
| 3914 | 0x04, 0x05 |
| 3915 | }; |
| 3916 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3917 | #define ALC260_DIGOUT_NID 0x03 |
| 3918 | #define ALC260_DIGIN_NID 0x06 |
| 3919 | |
| 3920 | static struct hda_input_mux alc260_capture_source = { |
| 3921 | .num_items = 4, |
| 3922 | .items = { |
| 3923 | { "Mic", 0x0 }, |
| 3924 | { "Front Mic", 0x1 }, |
| 3925 | { "Line", 0x2 }, |
| 3926 | { "CD", 0x4 }, |
| 3927 | }, |
| 3928 | }; |
| 3929 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3930 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3931 | * headphone jack and the internal CD lines since these are the only pins at |
| 3932 | * which audio can appear. For flexibility, also allow the option of |
| 3933 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3934 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3935 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3936 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3937 | { |
| 3938 | .num_items = 3, |
| 3939 | .items = { |
| 3940 | { "Mic/Line", 0x0 }, |
| 3941 | { "CD", 0x4 }, |
| 3942 | { "Headphone", 0x2 }, |
| 3943 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3944 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3945 | { |
| 3946 | .num_items = 4, |
| 3947 | .items = { |
| 3948 | { "Mic/Line", 0x0 }, |
| 3949 | { "CD", 0x4 }, |
| 3950 | { "Headphone", 0x2 }, |
| 3951 | { "Mixer", 0x5 }, |
| 3952 | }, |
| 3953 | }, |
| 3954 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3955 | }; |
| 3956 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3957 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3958 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3959 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3960 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3961 | { |
| 3962 | .num_items = 4, |
| 3963 | .items = { |
| 3964 | { "Mic", 0x0 }, |
| 3965 | { "Line", 0x2 }, |
| 3966 | { "CD", 0x4 }, |
| 3967 | { "Headphone", 0x5 }, |
| 3968 | }, |
| 3969 | }, |
| 3970 | { |
| 3971 | .num_items = 5, |
| 3972 | .items = { |
| 3973 | { "Mic", 0x0 }, |
| 3974 | { "Line", 0x2 }, |
| 3975 | { "CD", 0x4 }, |
| 3976 | { "Headphone", 0x6 }, |
| 3977 | { "Mixer", 0x5 }, |
| 3978 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3979 | }, |
| 3980 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3981 | /* |
| 3982 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3983 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3984 | * element which allows changing the channel mode, so the verb list is |
| 3985 | * never used. |
| 3986 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3987 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3988 | { 2, NULL }, |
| 3989 | }; |
| 3990 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3991 | |
| 3992 | /* Mixer combinations |
| 3993 | * |
| 3994 | * basic: base_output + input + pc_beep + capture |
| 3995 | * HP: base_output + input + capture_alt |
| 3996 | * HP_3013: hp_3013 + input + capture |
| 3997 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3998 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3999 | */ |
| 4000 | |
| 4001 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4002 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4003 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4004 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4005 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4006 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4007 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4008 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4009 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4010 | |
| 4011 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4012 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4013 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4014 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4015 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4016 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4017 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4018 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4019 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4020 | { } /* end */ |
| 4021 | }; |
| 4022 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4023 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 4024 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4025 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4026 | { } /* end */ |
| 4027 | }; |
| 4028 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4029 | /* update HP, line and mono out pins according to the master switch */ |
| 4030 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4031 | hda_nid_t hp, hda_nid_t line, |
| 4032 | hda_nid_t mono) |
| 4033 | { |
| 4034 | struct alc_spec *spec = codec->spec; |
| 4035 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4036 | /* change HP and line-out pins */ |
| 4037 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4038 | val); |
| 4039 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4040 | val); |
| 4041 | /* mono (speaker) depending on the HP jack sense */ |
| 4042 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 4043 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4044 | val); |
| 4045 | } |
| 4046 | |
| 4047 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4048 | struct snd_ctl_elem_value *ucontrol) |
| 4049 | { |
| 4050 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4051 | struct alc_spec *spec = codec->spec; |
| 4052 | *ucontrol->value.integer.value = spec->master_sw; |
| 4053 | return 0; |
| 4054 | } |
| 4055 | |
| 4056 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4057 | struct snd_ctl_elem_value *ucontrol) |
| 4058 | { |
| 4059 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4060 | struct alc_spec *spec = codec->spec; |
| 4061 | int val = !!*ucontrol->value.integer.value; |
| 4062 | hda_nid_t hp, line, mono; |
| 4063 | |
| 4064 | if (val == spec->master_sw) |
| 4065 | return 0; |
| 4066 | spec->master_sw = val; |
| 4067 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4068 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4069 | mono = kcontrol->private_value & 0xff; |
| 4070 | alc260_hp_master_update(codec, hp, line, mono); |
| 4071 | return 1; |
| 4072 | } |
| 4073 | |
| 4074 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4075 | { |
| 4076 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4077 | .name = "Master Playback Switch", |
| 4078 | .info = snd_ctl_boolean_mono_info, |
| 4079 | .get = alc260_hp_master_sw_get, |
| 4080 | .put = alc260_hp_master_sw_put, |
| 4081 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4082 | }, |
| 4083 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4084 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4085 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4086 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4087 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4088 | HDA_OUTPUT), |
| 4089 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4090 | { } /* end */ |
| 4091 | }; |
| 4092 | |
| 4093 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4094 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4095 | {}, |
| 4096 | }; |
| 4097 | |
| 4098 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4099 | { |
| 4100 | struct alc_spec *spec = codec->spec; |
| 4101 | unsigned int present; |
| 4102 | |
| 4103 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4104 | AC_VERB_GET_PIN_SENSE, 0); |
| 4105 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4106 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4107 | } |
| 4108 | |
| 4109 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4110 | { |
| 4111 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4112 | alc260_hp_automute(codec); |
| 4113 | } |
| 4114 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4115 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4116 | { |
| 4117 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4118 | .name = "Master Playback Switch", |
| 4119 | .info = snd_ctl_boolean_mono_info, |
| 4120 | .get = alc260_hp_master_sw_get, |
| 4121 | .put = alc260_hp_master_sw_put, |
| 4122 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 4123 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4124 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4125 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4126 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4127 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4128 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4129 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4130 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4131 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4132 | { } /* end */ |
| 4133 | }; |
| 4134 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4135 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4136 | .ops = &snd_hda_bind_vol, |
| 4137 | .values = { |
| 4138 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4139 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4140 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4141 | 0 |
| 4142 | }, |
| 4143 | }; |
| 4144 | |
| 4145 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4146 | .ops = &snd_hda_bind_sw, |
| 4147 | .values = { |
| 4148 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4149 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4150 | 0 |
| 4151 | }, |
| 4152 | }; |
| 4153 | |
| 4154 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4155 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4156 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4157 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4158 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4159 | { } /* end */ |
| 4160 | }; |
| 4161 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4162 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4163 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4164 | {}, |
| 4165 | }; |
| 4166 | |
| 4167 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4168 | { |
| 4169 | struct alc_spec *spec = codec->spec; |
| 4170 | unsigned int present; |
| 4171 | |
| 4172 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4173 | AC_VERB_GET_PIN_SENSE, 0); |
| 4174 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4175 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 4176 | } |
| 4177 | |
| 4178 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4179 | unsigned int res) |
| 4180 | { |
| 4181 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4182 | alc260_hp_3013_automute(codec); |
| 4183 | } |
| 4184 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4185 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4186 | { |
| 4187 | unsigned int present, bits; |
| 4188 | |
| 4189 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4190 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4191 | |
| 4192 | bits = present ? 0 : PIN_OUT; |
| 4193 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4194 | bits); |
| 4195 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4196 | bits); |
| 4197 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4198 | bits); |
| 4199 | } |
| 4200 | |
| 4201 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4202 | unsigned int res) |
| 4203 | { |
| 4204 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4205 | alc260_hp_3012_automute(codec); |
| 4206 | } |
| 4207 | |
| 4208 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4209 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4210 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4211 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4212 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4213 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4214 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4215 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4216 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4217 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4218 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4219 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4220 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4221 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4222 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4223 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4224 | { } /* end */ |
| 4225 | }; |
| 4226 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4227 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4228 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4229 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4230 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4231 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4232 | * revisions available in early 2006. Therefore for now allow the |
| 4233 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4234 | * that the lack of mic bias for this NID is intentional we could change the |
| 4235 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4236 | * |
| 4237 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4238 | * don't appear to make the mic bias available from the "line" jack, even |
| 4239 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4240 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4241 | * and the output jack. If this turns out to be the case for all such |
| 4242 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4243 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4244 | * |
| 4245 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4246 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4247 | * controls for such models. On models without a "mono speaker" the control |
| 4248 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4249 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4250 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4251 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4252 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4253 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4254 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4255 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4256 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4257 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4258 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4259 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4260 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4261 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4262 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4263 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4264 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4265 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4266 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4267 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4268 | { } /* end */ |
| 4269 | }; |
| 4270 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4271 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4272 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4273 | */ |
| 4274 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4275 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4276 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4277 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4278 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4279 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4280 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4281 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4282 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4283 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4284 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4285 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4286 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4287 | { } /* end */ |
| 4288 | }; |
| 4289 | |
| 4290 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4291 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4292 | */ |
| 4293 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4294 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4295 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4296 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4297 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4298 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4299 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4300 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4301 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4302 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4303 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4304 | { } /* end */ |
| 4305 | }; |
| 4306 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4307 | /* capture mixer elements */ |
| 4308 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4309 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4310 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4311 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4312 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4313 | { |
| 4314 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4315 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4316 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4317 | */ |
| 4318 | /* .name = "Capture Source", */ |
| 4319 | .name = "Input Source", |
| 4320 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4321 | .info = alc_mux_enum_info, |
| 4322 | .get = alc_mux_enum_get, |
| 4323 | .put = alc_mux_enum_put, |
| 4324 | }, |
| 4325 | { } /* end */ |
| 4326 | }; |
| 4327 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4328 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4329 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4330 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4331 | { |
| 4332 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4333 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4334 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4335 | */ |
| 4336 | /* .name = "Capture Source", */ |
| 4337 | .name = "Input Source", |
| 4338 | .count = 1, |
| 4339 | .info = alc_mux_enum_info, |
| 4340 | .get = alc_mux_enum_get, |
| 4341 | .put = alc_mux_enum_put, |
| 4342 | }, |
| 4343 | { } /* end */ |
| 4344 | }; |
| 4345 | |
| 4346 | /* |
| 4347 | * initialization verbs |
| 4348 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4349 | static struct hda_verb alc260_init_verbs[] = { |
| 4350 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4351 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4352 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4353 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4354 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4355 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4356 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4357 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4358 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4359 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4360 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4361 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4362 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4363 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4364 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4365 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4366 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4367 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4368 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4369 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4370 | /* set connection select to line in (default select for this ADC) */ |
| 4371 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4372 | /* mute capture amp left and right */ |
| 4373 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4374 | /* set connection select to line in (default select for this ADC) */ |
| 4375 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4376 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4377 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4378 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4379 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4380 | /* set vol=0 HP mixer amp left and right */ |
| 4381 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4382 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4383 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4384 | /* set vol=0 Mono mixer amp left and right */ |
| 4385 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4386 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4387 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4388 | /* unmute LINE-2 out pin */ |
| 4389 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4390 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4391 | * Line In 2 = 0x03 |
| 4392 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4393 | /* mute analog inputs */ |
| 4394 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4395 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4396 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4399 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4400 | /* mute Front out path */ |
| 4401 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4402 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4403 | /* mute Headphone out path */ |
| 4404 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4405 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4406 | /* mute Mono out path */ |
| 4407 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4408 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4409 | { } |
| 4410 | }; |
| 4411 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4412 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4413 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4414 | /* Headphone and output */ |
| 4415 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4416 | /* mono output */ |
| 4417 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4418 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4419 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4420 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4421 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4422 | /* Line In pin widget for input */ |
| 4423 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4424 | /* Line-2 pin widget for output */ |
| 4425 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4426 | /* CD pin widget for input */ |
| 4427 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4428 | /* unmute amp left and right */ |
| 4429 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4430 | /* set connection select to line in (default select for this ADC) */ |
| 4431 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4432 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4433 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4434 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4435 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4436 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4437 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4438 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4439 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4440 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4441 | * Line In 2 = 0x03 |
| 4442 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4443 | /* mute analog inputs */ |
| 4444 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4445 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4446 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4447 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4448 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4449 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4450 | /* Unmute Front out path */ |
| 4451 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4452 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4453 | /* Unmute Headphone out path */ |
| 4454 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4455 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4456 | /* Unmute Mono out path */ |
| 4457 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4458 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4459 | { } |
| 4460 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4461 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4462 | |
| 4463 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4464 | /* Line out and output */ |
| 4465 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4466 | /* mono output */ |
| 4467 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4468 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4469 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4470 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4471 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4472 | /* Line In pin widget for input */ |
| 4473 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4474 | /* Headphone pin widget for output */ |
| 4475 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4476 | /* CD pin widget for input */ |
| 4477 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4478 | /* unmute amp left and right */ |
| 4479 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4480 | /* set connection select to line in (default select for this ADC) */ |
| 4481 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4482 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4483 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4484 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4485 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4486 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4487 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4488 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4489 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4490 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4491 | * Line In 2 = 0x03 |
| 4492 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4493 | /* mute analog inputs */ |
| 4494 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4495 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4496 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4497 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4498 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4499 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4500 | /* Unmute Front out path */ |
| 4501 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4502 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4503 | /* Unmute Headphone out path */ |
| 4504 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4505 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4506 | /* Unmute Mono out path */ |
| 4507 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4508 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4509 | { } |
| 4510 | }; |
| 4511 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4512 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4513 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4514 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4515 | */ |
| 4516 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4517 | /* Disable all GPIOs */ |
| 4518 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4519 | /* Internal speaker is connected to headphone pin */ |
| 4520 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4521 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4522 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4523 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4524 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4525 | /* Ensure all other unused pins are disabled and muted. */ |
| 4526 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4527 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4528 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4529 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4530 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4531 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4532 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4533 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4534 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4535 | /* Disable digital (SPDIF) pins */ |
| 4536 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4537 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4538 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4539 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4540 | * when acting as an output. |
| 4541 | */ |
| 4542 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4543 | |
| 4544 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4545 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4546 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4547 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4548 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4549 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4550 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4551 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4552 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4553 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4554 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4555 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4556 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4557 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4558 | * If the pin mode is changed by the user the pin mode control will |
| 4559 | * take care of enabling the pin's input/output buffers as needed. |
| 4560 | * Therefore there's no need to enable the input buffer at this |
| 4561 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4562 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4563 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4564 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4565 | * mixer ctrl) |
| 4566 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4567 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4568 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4569 | /* Mute capture amp left and right */ |
| 4570 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4571 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4572 | * in (on mic1 pin) |
| 4573 | */ |
| 4574 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4575 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4576 | /* Do the same for the second ADC: mute capture input amp and |
| 4577 | * set ADC connection to line in (on mic1 pin) |
| 4578 | */ |
| 4579 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4580 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4581 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4582 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4583 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4584 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4585 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4586 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4587 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4588 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4589 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4590 | {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] | 4591 | |
| 4592 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4593 | }; |
| 4594 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4595 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4596 | * similar laptops (adapted from Fujitsu init verbs). |
| 4597 | */ |
| 4598 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4599 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4600 | * the headphone jack. Turn this on and rely on the standard mute |
| 4601 | * methods whenever the user wants to turn these outputs off. |
| 4602 | */ |
| 4603 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4604 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4605 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4606 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4607 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4608 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4609 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4610 | /* Line In jack is connected to Line1 pin */ |
| 4611 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4612 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4613 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4614 | /* Ensure all other unused pins are disabled and muted. */ |
| 4615 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4616 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4617 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4618 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4619 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4620 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4621 | /* Disable digital (SPDIF) pins */ |
| 4622 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4623 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4624 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4625 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4626 | * bus when acting as outputs. |
| 4627 | */ |
| 4628 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4629 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4630 | |
| 4631 | /* Start with output sum widgets muted and their output gains at min */ |
| 4632 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4633 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4634 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4635 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4636 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4637 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4638 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4639 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4640 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4641 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4642 | /* Unmute Line-out pin widget amp left and right |
| 4643 | * (no equiv mixer ctrl) |
| 4644 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4645 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4646 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4647 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4648 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4649 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4650 | * will take care of enabling the pin's input/output buffers as needed. |
| 4651 | * Therefore there's no need to enable the input buffer at this |
| 4652 | * stage. |
| 4653 | */ |
| 4654 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4655 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4656 | |
| 4657 | /* Mute capture amp left and right */ |
| 4658 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4659 | /* Set ADC connection select to match default mixer setting - mic |
| 4660 | * (on mic1 pin) |
| 4661 | */ |
| 4662 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4663 | |
| 4664 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4665 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4666 | */ |
| 4667 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4668 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4669 | |
| 4670 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4671 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4672 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4673 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4674 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4675 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4676 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4677 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4678 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4679 | |
| 4680 | { } |
| 4681 | }; |
| 4682 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4683 | static struct hda_verb alc260_will_verbs[] = { |
| 4684 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4685 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4686 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4687 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4688 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4689 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4690 | {} |
| 4691 | }; |
| 4692 | |
| 4693 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4694 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4695 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4696 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4697 | |
| 4698 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4699 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4700 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4701 | |
| 4702 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4703 | {} |
| 4704 | }; |
| 4705 | |
| 4706 | /* toggle speaker-output according to the hp-jack state */ |
| 4707 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4708 | { |
| 4709 | unsigned int present; |
| 4710 | |
| 4711 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4712 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4713 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4714 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4715 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4716 | AC_VERB_SET_GPIO_DATA, 1); |
| 4717 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4718 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4719 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4720 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4721 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4722 | AC_VERB_SET_GPIO_DATA, 0); |
| 4723 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4724 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4725 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4726 | } |
| 4727 | } |
| 4728 | |
| 4729 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4730 | unsigned int res) |
| 4731 | { |
| 4732 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4733 | alc260_replacer_672v_automute(codec); |
| 4734 | } |
| 4735 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4736 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 4737 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4738 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4739 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4740 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4741 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4742 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4743 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4744 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4745 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4746 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4747 | {} |
| 4748 | }; |
| 4749 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4750 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4751 | * configuration. |
| 4752 | */ |
| 4753 | #ifdef CONFIG_SND_DEBUG |
| 4754 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4755 | 0x02, |
| 4756 | }; |
| 4757 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4758 | 0x04, 0x05, |
| 4759 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4760 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4761 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4762 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4763 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4764 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4765 | { |
| 4766 | .num_items = 7, |
| 4767 | .items = { |
| 4768 | { "MIC1 pin", 0x0 }, |
| 4769 | { "MIC2 pin", 0x1 }, |
| 4770 | { "LINE1 pin", 0x2 }, |
| 4771 | { "LINE2 pin", 0x3 }, |
| 4772 | { "CD pin", 0x4 }, |
| 4773 | { "LINE-OUT pin", 0x5 }, |
| 4774 | { "HP-OUT pin", 0x6 }, |
| 4775 | }, |
| 4776 | }, |
| 4777 | { |
| 4778 | .num_items = 8, |
| 4779 | .items = { |
| 4780 | { "MIC1 pin", 0x0 }, |
| 4781 | { "MIC2 pin", 0x1 }, |
| 4782 | { "LINE1 pin", 0x2 }, |
| 4783 | { "LINE2 pin", 0x3 }, |
| 4784 | { "CD pin", 0x4 }, |
| 4785 | { "Mixer", 0x5 }, |
| 4786 | { "LINE-OUT pin", 0x6 }, |
| 4787 | { "HP-OUT pin", 0x7 }, |
| 4788 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4789 | }, |
| 4790 | }; |
| 4791 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4792 | /* Output driver widgets */ |
| 4793 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4794 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4795 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4796 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4797 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4798 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4799 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4800 | /* Modes for retasking pin widgets |
| 4801 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4802 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4803 | * mention this restriction. At this stage it's not clear whether |
| 4804 | * this behaviour is intentional or is a hardware bug in chip |
| 4805 | * revisions available at least up until early 2006. Therefore for |
| 4806 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4807 | * choices, but if it turns out that the lack of mic bias for these |
| 4808 | * NIDs is intentional we could change their modes from |
| 4809 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4810 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4811 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4812 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4813 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4814 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4815 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4816 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4817 | |
| 4818 | /* Loopback mixer controls */ |
| 4819 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4820 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4821 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4822 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4823 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4824 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4825 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4826 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4827 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4828 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4829 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4830 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4831 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4832 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4833 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4834 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4835 | |
| 4836 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4837 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4838 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4839 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4840 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4841 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4842 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4843 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4844 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4845 | */ |
| 4846 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4847 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4848 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4849 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4850 | * this output to turn on an external amplifier. |
| 4851 | */ |
| 4852 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4853 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4854 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4855 | { } /* end */ |
| 4856 | }; |
| 4857 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4858 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4859 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4860 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4861 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4862 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4863 | /* Enable retasking pins as output, initially without power amp */ |
| 4864 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4865 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4866 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4867 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4868 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4869 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4870 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4871 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4872 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4873 | * payload also sets the generation to 0, output to be in "consumer" |
| 4874 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4875 | * control. |
| 4876 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4877 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4878 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4879 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4880 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4881 | * OUT1 sum bus when acting as an output. |
| 4882 | */ |
| 4883 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4884 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4885 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4886 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4887 | |
| 4888 | /* Start with output sum widgets muted and their output gains at min */ |
| 4889 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4890 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4891 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4892 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4893 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4894 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4895 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4896 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4897 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4898 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4899 | /* Unmute retasking pin widget output buffers since the default |
| 4900 | * state appears to be output. As the pin mode is changed by the |
| 4901 | * user the pin mode control will take care of enabling the pin's |
| 4902 | * input/output buffers as needed. |
| 4903 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4904 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4905 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4906 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4907 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4908 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4909 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4910 | /* Also unmute the mono-out pin widget */ |
| 4911 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4912 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4913 | /* Mute capture amp left and right */ |
| 4914 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4915 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4916 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4917 | */ |
| 4918 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4919 | |
| 4920 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4921 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4922 | */ |
| 4923 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4924 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4925 | |
| 4926 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4927 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4929 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4930 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4931 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4932 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4933 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4934 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4935 | |
| 4936 | { } |
| 4937 | }; |
| 4938 | #endif |
| 4939 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4940 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4941 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4942 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4943 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4944 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4945 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4946 | /* |
| 4947 | * for BIOS auto-configuration |
| 4948 | */ |
| 4949 | |
| 4950 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4951 | const char *pfx) |
| 4952 | { |
| 4953 | hda_nid_t nid_vol; |
| 4954 | unsigned long vol_val, sw_val; |
| 4955 | char name[32]; |
| 4956 | int err; |
| 4957 | |
| 4958 | if (nid >= 0x0f && nid < 0x11) { |
| 4959 | nid_vol = nid - 0x7; |
| 4960 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4961 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4962 | } else if (nid == 0x11) { |
| 4963 | nid_vol = nid - 0x7; |
| 4964 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4965 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4966 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4967 | nid_vol = 0x08; |
| 4968 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4969 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4970 | } else |
| 4971 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4972 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4973 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4974 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4975 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4976 | return err; |
| 4977 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4978 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4979 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4980 | return err; |
| 4981 | return 1; |
| 4982 | } |
| 4983 | |
| 4984 | /* add playback controls from the parsed DAC table */ |
| 4985 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4986 | const struct auto_pin_cfg *cfg) |
| 4987 | { |
| 4988 | hda_nid_t nid; |
| 4989 | int err; |
| 4990 | |
| 4991 | spec->multiout.num_dacs = 1; |
| 4992 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4993 | spec->multiout.dac_nids[0] = 0x02; |
| 4994 | |
| 4995 | nid = cfg->line_out_pins[0]; |
| 4996 | if (nid) { |
| 4997 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4998 | if (err < 0) |
| 4999 | return err; |
| 5000 | } |
| 5001 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5002 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5003 | if (nid) { |
| 5004 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 5005 | if (err < 0) |
| 5006 | return err; |
| 5007 | } |
| 5008 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5009 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5010 | if (nid) { |
| 5011 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 5012 | if (err < 0) |
| 5013 | return err; |
| 5014 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5015 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5016 | } |
| 5017 | |
| 5018 | /* create playback/capture controls for input pins */ |
| 5019 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5020 | const struct auto_pin_cfg *cfg) |
| 5021 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5022 | struct hda_input_mux *imux = &spec->private_imux; |
| 5023 | int i, err, idx; |
| 5024 | |
| 5025 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5026 | if (cfg->input_pins[i] >= 0x12) { |
| 5027 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5028 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5029 | auto_pin_cfg_labels[i], idx, |
| 5030 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5031 | if (err < 0) |
| 5032 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5033 | imux->items[imux->num_items].label = |
| 5034 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5035 | imux->items[imux->num_items].index = idx; |
| 5036 | imux->num_items++; |
| 5037 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5038 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5039 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5040 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5041 | auto_pin_cfg_labels[i], idx, |
| 5042 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5043 | if (err < 0) |
| 5044 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5045 | imux->items[imux->num_items].label = |
| 5046 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5047 | imux->items[imux->num_items].index = idx; |
| 5048 | imux->num_items++; |
| 5049 | } |
| 5050 | } |
| 5051 | return 0; |
| 5052 | } |
| 5053 | |
| 5054 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5055 | hda_nid_t nid, int pin_type, |
| 5056 | int sel_idx) |
| 5057 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5058 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5059 | /* need the manual connection? */ |
| 5060 | if (nid >= 0x12) { |
| 5061 | int idx = nid - 0x12; |
| 5062 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5063 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5064 | } |
| 5065 | } |
| 5066 | |
| 5067 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5068 | { |
| 5069 | struct alc_spec *spec = codec->spec; |
| 5070 | hda_nid_t nid; |
| 5071 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5072 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5073 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5074 | if (nid) { |
| 5075 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5076 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5077 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5078 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5079 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5080 | if (nid) |
| 5081 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5082 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5083 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5084 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5085 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5086 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5087 | |
| 5088 | #define ALC260_PIN_CD_NID 0x16 |
| 5089 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5090 | { |
| 5091 | struct alc_spec *spec = codec->spec; |
| 5092 | int i; |
| 5093 | |
| 5094 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5095 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5096 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5097 | snd_hda_codec_write(codec, nid, 0, |
| 5098 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5099 | i <= AUTO_PIN_FRONT_MIC ? |
| 5100 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5101 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5102 | snd_hda_codec_write(codec, nid, 0, |
| 5103 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5104 | AMP_OUT_MUTE); |
| 5105 | } |
| 5106 | } |
| 5107 | } |
| 5108 | |
| 5109 | /* |
| 5110 | * generic initialization of ADC, input mixers and output mixers |
| 5111 | */ |
| 5112 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5113 | /* |
| 5114 | * Unmute ADC0-1 and set the default input to mic-in |
| 5115 | */ |
| 5116 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5117 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5118 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5119 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5120 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5121 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5122 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5123 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5124 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5125 | */ |
| 5126 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5127 | /* mute analog inputs */ |
| 5128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5133 | |
| 5134 | /* |
| 5135 | * Set up output mixers (0x08 - 0x0a) |
| 5136 | */ |
| 5137 | /* set vol=0 to output mixers */ |
| 5138 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5139 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5140 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5141 | /* set up input amps for analog loopback */ |
| 5142 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5143 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5144 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5145 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5146 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5147 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5148 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5149 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5150 | { } |
| 5151 | }; |
| 5152 | |
| 5153 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5154 | { |
| 5155 | struct alc_spec *spec = codec->spec; |
| 5156 | unsigned int wcap; |
| 5157 | int err; |
| 5158 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5159 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5160 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5161 | alc260_ignore); |
| 5162 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5163 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5164 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5165 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5166 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5167 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5168 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5169 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5170 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5171 | return err; |
| 5172 | |
| 5173 | spec->multiout.max_channels = 2; |
| 5174 | |
| 5175 | if (spec->autocfg.dig_out_pin) |
| 5176 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 5177 | if (spec->kctl_alloc) |
| 5178 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 5179 | |
| 5180 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 5181 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5182 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5183 | spec->input_mux = &spec->private_imux; |
| 5184 | |
| 5185 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5186 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5187 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 5188 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5189 | spec->adc_nids = alc260_adc_nids_alt; |
| 5190 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5191 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5192 | } else { |
| 5193 | spec->adc_nids = alc260_adc_nids; |
| 5194 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5195 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5196 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5197 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5198 | |
| 5199 | return 1; |
| 5200 | } |
| 5201 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5202 | /* additional initialization for auto-configuration model */ |
| 5203 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5204 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5205 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5206 | alc260_auto_init_multi_out(codec); |
| 5207 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5208 | if (spec->unsol_event) |
| 5209 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5210 | } |
| 5211 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5212 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5213 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5214 | { 0x07, HDA_INPUT, 0 }, |
| 5215 | { 0x07, HDA_INPUT, 1 }, |
| 5216 | { 0x07, HDA_INPUT, 2 }, |
| 5217 | { 0x07, HDA_INPUT, 3 }, |
| 5218 | { 0x07, HDA_INPUT, 4 }, |
| 5219 | { } /* end */ |
| 5220 | }; |
| 5221 | #endif |
| 5222 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5223 | /* |
| 5224 | * ALC260 configurations |
| 5225 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5226 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5227 | [ALC260_BASIC] = "basic", |
| 5228 | [ALC260_HP] = "hp", |
| 5229 | [ALC260_HP_3013] = "hp-3013", |
| 5230 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5231 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5232 | [ALC260_WILL] = "will", |
| 5233 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5234 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5235 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5236 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5237 | [ALC260_AUTO] = "auto", |
| 5238 | }; |
| 5239 | |
| 5240 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5241 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5242 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5243 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5244 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5245 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5246 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5247 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5248 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5249 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5250 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5251 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5252 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5253 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5254 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5255 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5256 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5257 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5258 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5259 | {} |
| 5260 | }; |
| 5261 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5262 | static struct alc_config_preset alc260_presets[] = { |
| 5263 | [ALC260_BASIC] = { |
| 5264 | .mixers = { alc260_base_output_mixer, |
| 5265 | alc260_input_mixer, |
| 5266 | alc260_pc_beep_mixer, |
| 5267 | alc260_capture_mixer }, |
| 5268 | .init_verbs = { alc260_init_verbs }, |
| 5269 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5270 | .dac_nids = alc260_dac_nids, |
| 5271 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5272 | .adc_nids = alc260_adc_nids, |
| 5273 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5274 | .channel_mode = alc260_modes, |
| 5275 | .input_mux = &alc260_capture_source, |
| 5276 | }, |
| 5277 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5278 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5279 | alc260_input_mixer, |
| 5280 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5281 | .init_verbs = { alc260_init_verbs, |
| 5282 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5283 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5284 | .dac_nids = alc260_dac_nids, |
| 5285 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5286 | .adc_nids = alc260_hp_adc_nids, |
| 5287 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5288 | .channel_mode = alc260_modes, |
| 5289 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5290 | .unsol_event = alc260_hp_unsol_event, |
| 5291 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5292 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5293 | [ALC260_HP_DC7600] = { |
| 5294 | .mixers = { alc260_hp_dc7600_mixer, |
| 5295 | alc260_input_mixer, |
| 5296 | alc260_capture_alt_mixer }, |
| 5297 | .init_verbs = { alc260_init_verbs, |
| 5298 | alc260_hp_dc7600_verbs }, |
| 5299 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5300 | .dac_nids = alc260_dac_nids, |
| 5301 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5302 | .adc_nids = alc260_hp_adc_nids, |
| 5303 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5304 | .channel_mode = alc260_modes, |
| 5305 | .input_mux = &alc260_capture_source, |
| 5306 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5307 | .init_hook = alc260_hp_3012_automute, |
| 5308 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5309 | [ALC260_HP_3013] = { |
| 5310 | .mixers = { alc260_hp_3013_mixer, |
| 5311 | alc260_input_mixer, |
| 5312 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5313 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5314 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5315 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5316 | .dac_nids = alc260_dac_nids, |
| 5317 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5318 | .adc_nids = alc260_hp_adc_nids, |
| 5319 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5320 | .channel_mode = alc260_modes, |
| 5321 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5322 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5323 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5324 | }, |
| 5325 | [ALC260_FUJITSU_S702X] = { |
| 5326 | .mixers = { alc260_fujitsu_mixer, |
| 5327 | alc260_capture_mixer }, |
| 5328 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5329 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5330 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5331 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5332 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5333 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5334 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5335 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5336 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5337 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5338 | [ALC260_ACER] = { |
| 5339 | .mixers = { alc260_acer_mixer, |
| 5340 | alc260_capture_mixer }, |
| 5341 | .init_verbs = { alc260_acer_init_verbs }, |
| 5342 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5343 | .dac_nids = alc260_dac_nids, |
| 5344 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5345 | .adc_nids = alc260_dual_adc_nids, |
| 5346 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5347 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5348 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5349 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5350 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5351 | [ALC260_WILL] = { |
| 5352 | .mixers = { alc260_will_mixer, |
| 5353 | alc260_capture_mixer }, |
| 5354 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5355 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5356 | .dac_nids = alc260_dac_nids, |
| 5357 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5358 | .adc_nids = alc260_adc_nids, |
| 5359 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5360 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5361 | .channel_mode = alc260_modes, |
| 5362 | .input_mux = &alc260_capture_source, |
| 5363 | }, |
| 5364 | [ALC260_REPLACER_672V] = { |
| 5365 | .mixers = { alc260_replacer_672v_mixer, |
| 5366 | alc260_capture_mixer }, |
| 5367 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5368 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5369 | .dac_nids = alc260_dac_nids, |
| 5370 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5371 | .adc_nids = alc260_adc_nids, |
| 5372 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5373 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5374 | .channel_mode = alc260_modes, |
| 5375 | .input_mux = &alc260_capture_source, |
| 5376 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5377 | .init_hook = alc260_replacer_672v_automute, |
| 5378 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5379 | #ifdef CONFIG_SND_DEBUG |
| 5380 | [ALC260_TEST] = { |
| 5381 | .mixers = { alc260_test_mixer, |
| 5382 | alc260_capture_mixer }, |
| 5383 | .init_verbs = { alc260_test_init_verbs }, |
| 5384 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5385 | .dac_nids = alc260_test_dac_nids, |
| 5386 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5387 | .adc_nids = alc260_test_adc_nids, |
| 5388 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5389 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5390 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5391 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5392 | }, |
| 5393 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5394 | }; |
| 5395 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5396 | static int patch_alc260(struct hda_codec *codec) |
| 5397 | { |
| 5398 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5399 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5400 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5401 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5402 | if (spec == NULL) |
| 5403 | return -ENOMEM; |
| 5404 | |
| 5405 | codec->spec = spec; |
| 5406 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5407 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5408 | alc260_models, |
| 5409 | alc260_cfg_tbl); |
| 5410 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5411 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5412 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5413 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5414 | } |
| 5415 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5416 | if (board_config == ALC260_AUTO) { |
| 5417 | /* automatic parse from the BIOS config */ |
| 5418 | err = alc260_parse_auto_config(codec); |
| 5419 | if (err < 0) { |
| 5420 | alc_free(codec); |
| 5421 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5422 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5423 | printk(KERN_INFO |
| 5424 | "hda_codec: Cannot set up configuration " |
| 5425 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5426 | board_config = ALC260_BASIC; |
| 5427 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5428 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5429 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5430 | if (board_config != ALC260_AUTO) |
| 5431 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5432 | |
| 5433 | spec->stream_name_analog = "ALC260 Analog"; |
| 5434 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5435 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5436 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5437 | spec->stream_name_digital = "ALC260 Digital"; |
| 5438 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5439 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5440 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5441 | spec->vmaster_nid = 0x08; |
| 5442 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5443 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5444 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5445 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5446 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5447 | if (!spec->loopback.amplist) |
| 5448 | spec->loopback.amplist = alc260_loopbacks; |
| 5449 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5450 | |
| 5451 | return 0; |
| 5452 | } |
| 5453 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5454 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5455 | /* |
| 5456 | * ALC882 support |
| 5457 | * |
| 5458 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5459 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5460 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5461 | * 6-channel independent captures. |
| 5462 | * |
| 5463 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5464 | * driver yet). |
| 5465 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5466 | #define ALC882_DIGOUT_NID 0x06 |
| 5467 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5468 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5469 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5470 | { 8, NULL } |
| 5471 | }; |
| 5472 | |
| 5473 | static hda_nid_t alc882_dac_nids[4] = { |
| 5474 | /* front, rear, clfe, rear_surr */ |
| 5475 | 0x02, 0x03, 0x04, 0x05 |
| 5476 | }; |
| 5477 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5478 | /* identical with ALC880 */ |
| 5479 | #define alc882_adc_nids alc880_adc_nids |
| 5480 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5481 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5482 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5483 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5484 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5485 | /* input MUX */ |
| 5486 | /* FIXME: should be a matrix-type input source selection */ |
| 5487 | |
| 5488 | static struct hda_input_mux alc882_capture_source = { |
| 5489 | .num_items = 4, |
| 5490 | .items = { |
| 5491 | { "Mic", 0x0 }, |
| 5492 | { "Front Mic", 0x1 }, |
| 5493 | { "Line", 0x2 }, |
| 5494 | { "CD", 0x4 }, |
| 5495 | }, |
| 5496 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5497 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5498 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5499 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5500 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5501 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5502 | { |
| 5503 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5504 | struct alc_spec *spec = codec->spec; |
| 5505 | const struct hda_input_mux *imux = spec->input_mux; |
| 5506 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5507 | hda_nid_t nid = spec->capsrc_nids ? |
| 5508 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5509 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5510 | unsigned int i, idx; |
| 5511 | |
| 5512 | idx = ucontrol->value.enumerated.item[0]; |
| 5513 | if (idx >= imux->num_items) |
| 5514 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5515 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5516 | return 0; |
| 5517 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5518 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5519 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5520 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5521 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5522 | } |
| 5523 | *cur_val = idx; |
| 5524 | return 1; |
| 5525 | } |
| 5526 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5527 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5528 | * 2ch mode |
| 5529 | */ |
| 5530 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5531 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5532 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5533 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5534 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5535 | { } /* end */ |
| 5536 | }; |
| 5537 | |
| 5538 | /* |
| 5539 | * 6ch mode |
| 5540 | */ |
| 5541 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5542 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5543 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5544 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5545 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5546 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5547 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5548 | { } /* end */ |
| 5549 | }; |
| 5550 | |
| 5551 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5552 | { 2, alc882_3ST_ch2_init }, |
| 5553 | { 6, alc882_3ST_ch6_init }, |
| 5554 | }; |
| 5555 | |
| 5556 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5557 | * 6ch mode |
| 5558 | */ |
| 5559 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5560 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5561 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5562 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5563 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5564 | { } /* end */ |
| 5565 | }; |
| 5566 | |
| 5567 | /* |
| 5568 | * 8ch mode |
| 5569 | */ |
| 5570 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5571 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5572 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5573 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5574 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5575 | { } /* end */ |
| 5576 | }; |
| 5577 | |
| 5578 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5579 | { 6, alc882_sixstack_ch6_init }, |
| 5580 | { 8, alc882_sixstack_ch8_init }, |
| 5581 | }; |
| 5582 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5583 | /* |
| 5584 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5585 | */ |
| 5586 | |
| 5587 | /* |
| 5588 | * 2ch mode |
| 5589 | */ |
| 5590 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5591 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5592 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5593 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5594 | { } /* end */ |
| 5595 | }; |
| 5596 | |
| 5597 | /* |
| 5598 | * 6ch mode |
| 5599 | */ |
| 5600 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5601 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5602 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5603 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5604 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5605 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5606 | { } /* end */ |
| 5607 | }; |
| 5608 | |
| 5609 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5610 | { 2, alc885_mbp_ch2_init }, |
| 5611 | { 6, alc885_mbp_ch6_init }, |
| 5612 | }; |
| 5613 | |
| 5614 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5615 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5616 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5617 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5618 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5619 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5620 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5621 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5622 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5623 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5624 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5625 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5626 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5627 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5628 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5629 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5630 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5631 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5632 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5633 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5634 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5635 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5636 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5637 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5638 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5639 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5640 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5641 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5642 | { } /* end */ |
| 5643 | }; |
| 5644 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5645 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5646 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5647 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5648 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5649 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5650 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5651 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5652 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5653 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5654 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5655 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5656 | { } /* end */ |
| 5657 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5658 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5659 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5660 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5661 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5662 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5663 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5664 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5665 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5666 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5667 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5668 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5669 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5670 | { } /* end */ |
| 5671 | }; |
| 5672 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5673 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5674 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5675 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5676 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5677 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5678 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5679 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5680 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5682 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5683 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5684 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5685 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5686 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5687 | { } /* end */ |
| 5688 | }; |
| 5689 | |
| 5690 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5691 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5692 | */ |
| 5693 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5694 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5695 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5696 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5697 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5698 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5699 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5700 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5701 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5702 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5703 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5704 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5705 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5706 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5707 | { } /* end */ |
| 5708 | }; |
| 5709 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5710 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5711 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5712 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5713 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5714 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5715 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5716 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5717 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5718 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5719 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5721 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5722 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5723 | { } /* end */ |
| 5724 | }; |
| 5725 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5726 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5727 | { |
| 5728 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5729 | .name = "Channel Mode", |
| 5730 | .info = alc_ch_mode_info, |
| 5731 | .get = alc_ch_mode_get, |
| 5732 | .put = alc_ch_mode_put, |
| 5733 | }, |
| 5734 | { } /* end */ |
| 5735 | }; |
| 5736 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5737 | static struct hda_verb alc882_init_verbs[] = { |
| 5738 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5739 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5740 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5741 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5742 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5743 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5744 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5745 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5746 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5747 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5748 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5749 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5750 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5751 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5752 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5753 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5754 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5755 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5756 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5757 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5758 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5759 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5760 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5761 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5762 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5763 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5764 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5765 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5766 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5767 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5768 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5769 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5770 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5771 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5772 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5773 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5774 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5775 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5776 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5777 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5778 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5779 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5780 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5781 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5782 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5783 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5784 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5785 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5786 | |
| 5787 | /* FIXME: use matrix-type input source selection */ |
| 5788 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5789 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5790 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5791 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5792 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5793 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5794 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5795 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5796 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5797 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5798 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5799 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5800 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5801 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5802 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5803 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5804 | /* ADC1: mute amp left and right */ |
| 5805 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5806 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5807 | /* ADC2: mute amp left and right */ |
| 5808 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5809 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5810 | /* ADC3: mute amp left and right */ |
| 5811 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5812 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5813 | |
| 5814 | { } |
| 5815 | }; |
| 5816 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5817 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5818 | /* change to EAPD mode */ |
| 5819 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5820 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5821 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5822 | }; |
| 5823 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5824 | /* Mac Pro test */ |
| 5825 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5826 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5827 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5828 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5829 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5830 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5831 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5832 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5833 | { } /* end */ |
| 5834 | }; |
| 5835 | |
| 5836 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5837 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5838 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5839 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5840 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5841 | /* Front Pin: output 0 (0x0c) */ |
| 5842 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5843 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5844 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5845 | /* Front Mic pin: input vref at 80% */ |
| 5846 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5847 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5848 | /* Speaker: output */ |
| 5849 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5850 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5851 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5852 | /* Headphone output (output 0 - 0x0c) */ |
| 5853 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5854 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5855 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5856 | |
| 5857 | /* FIXME: use matrix-type input source selection */ |
| 5858 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5859 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5860 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5861 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5862 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5863 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5864 | /* Input mixer2 */ |
| 5865 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5866 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5867 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5868 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5869 | /* Input mixer3 */ |
| 5870 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5871 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5872 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5873 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5874 | /* ADC1: mute amp left and right */ |
| 5875 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5876 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5877 | /* ADC2: mute amp left and right */ |
| 5878 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5879 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5880 | /* ADC3: mute amp left and right */ |
| 5881 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5882 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5883 | |
| 5884 | { } |
| 5885 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5886 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5887 | /* Macbook Pro rev3 */ |
| 5888 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5889 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5890 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5891 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5892 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5893 | /* Rear mixer */ |
| 5894 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5895 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5896 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5897 | /* Front Pin: output 0 (0x0c) */ |
| 5898 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5899 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5900 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5901 | /* HP Pin: output 0 (0x0d) */ |
| 5902 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5903 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5904 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5905 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5906 | /* Mic (rear) pin: input vref at 80% */ |
| 5907 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5908 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5909 | /* Front Mic pin: input vref at 80% */ |
| 5910 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5911 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5912 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5913 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5914 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5915 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5916 | |
| 5917 | /* FIXME: use matrix-type input source selection */ |
| 5918 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5919 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5920 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5921 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5922 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5923 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5924 | /* Input mixer2 */ |
| 5925 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5926 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5927 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5928 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5929 | /* Input mixer3 */ |
| 5930 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5931 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5932 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5933 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5934 | /* ADC1: mute amp left and right */ |
| 5935 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5936 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5937 | /* ADC2: mute amp left and right */ |
| 5938 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5939 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5940 | /* ADC3: mute amp left and right */ |
| 5941 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5942 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5943 | |
| 5944 | { } |
| 5945 | }; |
| 5946 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5947 | /* iMac 24 mixer. */ |
| 5948 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5949 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5950 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5951 | { } /* end */ |
| 5952 | }; |
| 5953 | |
| 5954 | /* iMac 24 init verbs. */ |
| 5955 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5956 | /* Internal speakers: output 0 (0x0c) */ |
| 5957 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5958 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5959 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5960 | /* Internal speakers: output 0 (0x0c) */ |
| 5961 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5962 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5963 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5964 | /* Headphone: output 0 (0x0c) */ |
| 5965 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5966 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5967 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5968 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5969 | /* Front Mic: input vref at 80% */ |
| 5970 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5971 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5972 | { } |
| 5973 | }; |
| 5974 | |
| 5975 | /* Toggle speaker-output according to the hp-jack state */ |
| 5976 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5977 | { |
| 5978 | unsigned int present; |
| 5979 | |
| 5980 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5981 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5982 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5983 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5984 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5985 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5986 | } |
| 5987 | |
| 5988 | /* Processes unsolicited events. */ |
| 5989 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5990 | unsigned int res) |
| 5991 | { |
| 5992 | /* Headphone insertion or removal. */ |
| 5993 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5994 | alc885_imac24_automute(codec); |
| 5995 | } |
| 5996 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5997 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5998 | { |
| 5999 | unsigned int present; |
| 6000 | |
| 6001 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6002 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6003 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6004 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6005 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6006 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6007 | |
| 6008 | } |
| 6009 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6010 | unsigned int res) |
| 6011 | { |
| 6012 | /* Headphone insertion or removal. */ |
| 6013 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6014 | alc885_mbp3_automute(codec); |
| 6015 | } |
| 6016 | |
| 6017 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6018 | static struct hda_verb alc882_targa_verbs[] = { |
| 6019 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6021 | |
| 6022 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6023 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6024 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6025 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6026 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6027 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6028 | |
| 6029 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6030 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6031 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6032 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6033 | { } /* end */ |
| 6034 | }; |
| 6035 | |
| 6036 | /* toggle speaker-output according to the hp-jack state */ |
| 6037 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6038 | { |
| 6039 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6040 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6041 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6042 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6043 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6044 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6045 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6046 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6047 | } |
| 6048 | |
| 6049 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6050 | { |
| 6051 | /* Looks like the unsol event is incompatible with the standard |
| 6052 | * definition. 4bit tag is placed at 26 bit! |
| 6053 | */ |
| 6054 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6055 | alc882_targa_automute(codec); |
| 6056 | } |
| 6057 | } |
| 6058 | |
| 6059 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6060 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6061 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6062 | |
| 6063 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6064 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6065 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6066 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6067 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6068 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6069 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6070 | |
| 6071 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6072 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6073 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6074 | { } /* end */ |
| 6075 | }; |
| 6076 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6077 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6078 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6079 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6080 | |
| 6081 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6082 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6083 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6084 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6085 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6086 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6087 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6088 | |
| 6089 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6090 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6091 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6092 | { } /* end */ |
| 6093 | }; |
| 6094 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6095 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6096 | { |
| 6097 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6098 | |
| 6099 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6100 | AC_VERB_GET_GPIO_DATA, 0); |
| 6101 | |
| 6102 | if (!muted) |
| 6103 | gpiostate |= (1 << pin); |
| 6104 | else |
| 6105 | gpiostate &= ~(1 << pin); |
| 6106 | |
| 6107 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6108 | AC_VERB_GET_GPIO_MASK, 0); |
| 6109 | gpiomask |= (1 << pin); |
| 6110 | |
| 6111 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6112 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6113 | gpiodir |= (1 << pin); |
| 6114 | |
| 6115 | |
| 6116 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6117 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6118 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6119 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6120 | |
| 6121 | msleep(1); |
| 6122 | |
| 6123 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6124 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6125 | } |
| 6126 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6127 | /* set up GPIO at initialization */ |
| 6128 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6129 | { |
| 6130 | alc882_gpio_mute(codec, 0, 0); |
| 6131 | alc882_gpio_mute(codec, 1, 0); |
| 6132 | } |
| 6133 | |
| 6134 | /* set up GPIO and update auto-muting at initialization */ |
| 6135 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6136 | { |
| 6137 | alc885_macpro_init_hook(codec); |
| 6138 | alc885_imac24_automute(codec); |
| 6139 | } |
| 6140 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6141 | /* |
| 6142 | * generic initialization of ADC, input mixers and output mixers |
| 6143 | */ |
| 6144 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6145 | /* |
| 6146 | * Unmute ADC0-2 and set the default input to mic-in |
| 6147 | */ |
| 6148 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6149 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6150 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6151 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6152 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6153 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6154 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6155 | /* 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] | 6156 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6157 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6158 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6159 | */ |
| 6160 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6161 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6162 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6163 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6164 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6165 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6166 | |
| 6167 | /* |
| 6168 | * Set up output mixers (0x0c - 0x0f) |
| 6169 | */ |
| 6170 | /* set vol=0 to output mixers */ |
| 6171 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6172 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6173 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6174 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6175 | /* set up input amps for analog loopback */ |
| 6176 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6177 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6178 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6179 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6180 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6181 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6182 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6183 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6184 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6185 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6186 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6187 | |
| 6188 | /* FIXME: use matrix-type input source selection */ |
| 6189 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6190 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6191 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6192 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6195 | /* Input mixer2 */ |
| 6196 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6197 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6198 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6199 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6200 | /* Input mixer3 */ |
| 6201 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6202 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6203 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6204 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6205 | |
| 6206 | { } |
| 6207 | }; |
| 6208 | |
| 6209 | /* capture mixer elements */ |
| 6210 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 6211 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6212 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6213 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6214 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6215 | { |
| 6216 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6217 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6218 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6219 | */ |
| 6220 | /* .name = "Capture Source", */ |
| 6221 | .name = "Input Source", |
| 6222 | .count = 2, |
| 6223 | .info = alc882_mux_enum_info, |
| 6224 | .get = alc882_mux_enum_get, |
| 6225 | .put = alc882_mux_enum_put, |
| 6226 | }, |
| 6227 | { } /* end */ |
| 6228 | }; |
| 6229 | |
| 6230 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 6231 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 6232 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 6233 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 6234 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 6235 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 6236 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 6237 | { |
| 6238 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6239 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6240 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6241 | */ |
| 6242 | /* .name = "Capture Source", */ |
| 6243 | .name = "Input Source", |
| 6244 | .count = 3, |
| 6245 | .info = alc882_mux_enum_info, |
| 6246 | .get = alc882_mux_enum_get, |
| 6247 | .put = alc882_mux_enum_put, |
| 6248 | }, |
| 6249 | { } /* end */ |
| 6250 | }; |
| 6251 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6252 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6253 | #define alc882_loopbacks alc880_loopbacks |
| 6254 | #endif |
| 6255 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6256 | /* pcm configuration: identiacal with ALC880 */ |
| 6257 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6258 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6259 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6260 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6261 | |
| 6262 | /* |
| 6263 | * configuration and preset |
| 6264 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6265 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6266 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6267 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6268 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6269 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6270 | [ALC882_TARGA] = "targa", |
| 6271 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6272 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6273 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6274 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6275 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6276 | [ALC882_AUTO] = "auto", |
| 6277 | }; |
| 6278 | |
| 6279 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6280 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6281 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6282 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6283 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6284 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6285 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6286 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6287 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6288 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6289 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6290 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6291 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6292 | {} |
| 6293 | }; |
| 6294 | |
| 6295 | static struct alc_config_preset alc882_presets[] = { |
| 6296 | [ALC882_3ST_DIG] = { |
| 6297 | .mixers = { alc882_base_mixer }, |
| 6298 | .init_verbs = { alc882_init_verbs }, |
| 6299 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6300 | .dac_nids = alc882_dac_nids, |
| 6301 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6302 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6303 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6304 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6305 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6306 | .input_mux = &alc882_capture_source, |
| 6307 | }, |
| 6308 | [ALC882_6ST_DIG] = { |
| 6309 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6310 | .init_verbs = { alc882_init_verbs }, |
| 6311 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6312 | .dac_nids = alc882_dac_nids, |
| 6313 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6314 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6315 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6316 | .channel_mode = alc882_sixstack_modes, |
| 6317 | .input_mux = &alc882_capture_source, |
| 6318 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6319 | [ALC882_ARIMA] = { |
| 6320 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6321 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6322 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6323 | .dac_nids = alc882_dac_nids, |
| 6324 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6325 | .channel_mode = alc882_sixstack_modes, |
| 6326 | .input_mux = &alc882_capture_source, |
| 6327 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6328 | [ALC882_W2JC] = { |
| 6329 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6330 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6331 | alc880_gpio1_init_verbs }, |
| 6332 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6333 | .dac_nids = alc882_dac_nids, |
| 6334 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6335 | .channel_mode = alc880_threestack_modes, |
| 6336 | .need_dac_fix = 1, |
| 6337 | .input_mux = &alc882_capture_source, |
| 6338 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6339 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6340 | [ALC885_MBP3] = { |
| 6341 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6342 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6343 | alc880_gpio1_init_verbs }, |
| 6344 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6345 | .dac_nids = alc882_dac_nids, |
| 6346 | .channel_mode = alc885_mbp_6ch_modes, |
| 6347 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6348 | .input_mux = &alc882_capture_source, |
| 6349 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6350 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6351 | .unsol_event = alc885_mbp3_unsol_event, |
| 6352 | .init_hook = alc885_mbp3_automute, |
| 6353 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6354 | [ALC885_MACPRO] = { |
| 6355 | .mixers = { alc882_macpro_mixer }, |
| 6356 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6357 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6358 | .dac_nids = alc882_dac_nids, |
| 6359 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6360 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6361 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6362 | .channel_mode = alc882_ch_modes, |
| 6363 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6364 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6365 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6366 | [ALC885_IMAC24] = { |
| 6367 | .mixers = { alc885_imac24_mixer }, |
| 6368 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6369 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6370 | .dac_nids = alc882_dac_nids, |
| 6371 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6372 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6373 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6374 | .channel_mode = alc882_ch_modes, |
| 6375 | .input_mux = &alc882_capture_source, |
| 6376 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6377 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6378 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6379 | [ALC882_TARGA] = { |
| 6380 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6381 | alc882_capture_mixer }, |
| 6382 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6383 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6384 | .dac_nids = alc882_dac_nids, |
| 6385 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6386 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6387 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6388 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6389 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6390 | .channel_mode = alc882_3ST_6ch_modes, |
| 6391 | .need_dac_fix = 1, |
| 6392 | .input_mux = &alc882_capture_source, |
| 6393 | .unsol_event = alc882_targa_unsol_event, |
| 6394 | .init_hook = alc882_targa_automute, |
| 6395 | }, |
| 6396 | [ALC882_ASUS_A7J] = { |
| 6397 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6398 | alc882_capture_mixer }, |
| 6399 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6400 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6401 | .dac_nids = alc882_dac_nids, |
| 6402 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6403 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6404 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6405 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6406 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6407 | .channel_mode = alc882_3ST_6ch_modes, |
| 6408 | .need_dac_fix = 1, |
| 6409 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6410 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6411 | [ALC882_ASUS_A7M] = { |
| 6412 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6413 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6414 | alc880_gpio1_init_verbs, |
| 6415 | alc882_asus_a7m_verbs }, |
| 6416 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6417 | .dac_nids = alc882_dac_nids, |
| 6418 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6419 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6420 | .channel_mode = alc880_threestack_modes, |
| 6421 | .need_dac_fix = 1, |
| 6422 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6423 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6424 | }; |
| 6425 | |
| 6426 | |
| 6427 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6428 | * Pin config fixes |
| 6429 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6430 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6431 | PINFIX_ABIT_AW9D_MAX |
| 6432 | }; |
| 6433 | |
| 6434 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6435 | { 0x15, 0x01080104 }, /* side */ |
| 6436 | { 0x16, 0x01011012 }, /* rear */ |
| 6437 | { 0x17, 0x01016011 }, /* clfe */ |
| 6438 | { } |
| 6439 | }; |
| 6440 | |
| 6441 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6442 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6443 | }; |
| 6444 | |
| 6445 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6446 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6447 | {} |
| 6448 | }; |
| 6449 | |
| 6450 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6451 | * BIOS auto configuration |
| 6452 | */ |
| 6453 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6454 | hda_nid_t nid, int pin_type, |
| 6455 | int dac_idx) |
| 6456 | { |
| 6457 | /* set as output */ |
| 6458 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6459 | int idx; |
| 6460 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6461 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6462 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6463 | idx = 4; |
| 6464 | else |
| 6465 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6466 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6467 | |
| 6468 | } |
| 6469 | |
| 6470 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6471 | { |
| 6472 | struct alc_spec *spec = codec->spec; |
| 6473 | int i; |
| 6474 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6475 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6476 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6477 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6478 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6479 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6480 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6481 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6482 | } |
| 6483 | } |
| 6484 | |
| 6485 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6486 | { |
| 6487 | struct alc_spec *spec = codec->spec; |
| 6488 | hda_nid_t pin; |
| 6489 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6490 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6491 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6492 | /* use dac 0 */ |
| 6493 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6494 | pin = spec->autocfg.speaker_pins[0]; |
| 6495 | if (pin) |
| 6496 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6497 | } |
| 6498 | |
| 6499 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6500 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6501 | |
| 6502 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6503 | { |
| 6504 | struct alc_spec *spec = codec->spec; |
| 6505 | int i; |
| 6506 | |
| 6507 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6508 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6509 | unsigned int vref; |
| 6510 | if (!nid) |
| 6511 | continue; |
| 6512 | vref = PIN_IN; |
| 6513 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6514 | unsigned int pincap; |
| 6515 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6516 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6517 | AC_PINCAP_VREF_80) |
| 6518 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6519 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6520 | snd_hda_codec_write(codec, nid, 0, |
| 6521 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6522 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6523 | snd_hda_codec_write(codec, nid, 0, |
| 6524 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6525 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6526 | } |
| 6527 | } |
| 6528 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6529 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 6530 | { |
| 6531 | struct alc_spec *spec = codec->spec; |
| 6532 | const struct hda_input_mux *imux = spec->input_mux; |
| 6533 | int c; |
| 6534 | |
| 6535 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 6536 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 6537 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 6538 | int conns, mute, idx, item; |
| 6539 | |
| 6540 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 6541 | ARRAY_SIZE(conn_list)); |
| 6542 | if (conns < 0) |
| 6543 | continue; |
| 6544 | for (idx = 0; idx < conns; idx++) { |
| 6545 | /* if the current connection is the selected one, |
| 6546 | * unmute it as default - otherwise mute it |
| 6547 | */ |
| 6548 | mute = AMP_IN_MUTE(idx); |
| 6549 | for (item = 0; item < imux->num_items; item++) { |
| 6550 | if (imux->items[item].index == idx) { |
| 6551 | if (spec->cur_mux[c] == item) |
| 6552 | mute = AMP_IN_UNMUTE(idx); |
| 6553 | break; |
| 6554 | } |
| 6555 | } |
| 6556 | snd_hda_codec_write(codec, nid, 0, |
| 6557 | AC_VERB_SET_AMP_GAIN_MUTE, mute); |
| 6558 | } |
| 6559 | } |
| 6560 | } |
| 6561 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6562 | /* add mic boosts if needed */ |
| 6563 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6564 | { |
| 6565 | struct alc_spec *spec = codec->spec; |
| 6566 | int err; |
| 6567 | hda_nid_t nid; |
| 6568 | |
| 6569 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6570 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6571 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6572 | "Mic Boost", |
| 6573 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6574 | if (err < 0) |
| 6575 | return err; |
| 6576 | } |
| 6577 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6578 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6579 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6580 | "Front Mic Boost", |
| 6581 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6582 | if (err < 0) |
| 6583 | return err; |
| 6584 | } |
| 6585 | return 0; |
| 6586 | } |
| 6587 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6588 | /* almost identical with ALC880 parser... */ |
| 6589 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6590 | { |
| 6591 | struct alc_spec *spec = codec->spec; |
| 6592 | int err = alc880_parse_auto_config(codec); |
| 6593 | |
| 6594 | if (err < 0) |
| 6595 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6596 | else if (!err) |
| 6597 | return 0; /* no config found */ |
| 6598 | |
| 6599 | err = alc_auto_add_mic_boost(codec); |
| 6600 | if (err < 0) |
| 6601 | return err; |
| 6602 | |
| 6603 | /* hack - override the init verbs */ |
| 6604 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6605 | |
| 6606 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6607 | } |
| 6608 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6609 | /* additional initialization for auto-configuration model */ |
| 6610 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6611 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6612 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6613 | alc882_auto_init_multi_out(codec); |
| 6614 | alc882_auto_init_hp_out(codec); |
| 6615 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6616 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6617 | if (spec->unsol_event) |
| 6618 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6619 | } |
| 6620 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6621 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6622 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6623 | static int patch_alc882(struct hda_codec *codec) |
| 6624 | { |
| 6625 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6626 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6627 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6628 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6629 | if (spec == NULL) |
| 6630 | return -ENOMEM; |
| 6631 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6632 | codec->spec = spec; |
| 6633 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6634 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6635 | alc882_models, |
| 6636 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6637 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6638 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6639 | /* Pick up systems that don't supply PCI SSID */ |
| 6640 | switch (codec->subsystem_id) { |
| 6641 | case 0x106b0c00: /* Mac Pro */ |
| 6642 | board_config = ALC885_MACPRO; |
| 6643 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6644 | case 0x106b1000: /* iMac 24 */ |
| 6645 | board_config = ALC885_IMAC24; |
| 6646 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6647 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6648 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6649 | case 0x106b3600: /* Macbook 3.1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6650 | board_config = ALC885_MBP3; |
| 6651 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6652 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6653 | /* ALC889A is handled better as ALC888-compatible */ |
| 6654 | if (codec->revision_id == 0x100103) { |
| 6655 | alc_free(codec); |
| 6656 | return patch_alc883(codec); |
| 6657 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6658 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6659 | "trying auto-probe from BIOS...\n"); |
| 6660 | board_config = ALC882_AUTO; |
| 6661 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6662 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6663 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6664 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6665 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6666 | if (board_config == ALC882_AUTO) { |
| 6667 | /* automatic parse from the BIOS config */ |
| 6668 | err = alc882_parse_auto_config(codec); |
| 6669 | if (err < 0) { |
| 6670 | alc_free(codec); |
| 6671 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6672 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6673 | printk(KERN_INFO |
| 6674 | "hda_codec: Cannot set up configuration " |
| 6675 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6676 | board_config = ALC882_3ST_DIG; |
| 6677 | } |
| 6678 | } |
| 6679 | |
| 6680 | if (board_config != ALC882_AUTO) |
| 6681 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6682 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 6683 | if (codec->vendor_id == 0x10ec0885) { |
| 6684 | spec->stream_name_analog = "ALC885 Analog"; |
| 6685 | spec->stream_name_digital = "ALC885 Digital"; |
| 6686 | } else { |
| 6687 | spec->stream_name_analog = "ALC882 Analog"; |
| 6688 | spec->stream_name_digital = "ALC882 Digital"; |
| 6689 | } |
| 6690 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6691 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6692 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6693 | /* FIXME: setup DAC5 */ |
| 6694 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6695 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6696 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6697 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6698 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6699 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6700 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6701 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6702 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6703 | /* get type */ |
| 6704 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6705 | if (wcap != AC_WID_AUD_IN) { |
| 6706 | spec->adc_nids = alc882_adc_nids_alt; |
| 6707 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6708 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6709 | spec->mixers[spec->num_mixers] = |
| 6710 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6711 | spec->num_mixers++; |
| 6712 | } else { |
| 6713 | spec->adc_nids = alc882_adc_nids; |
| 6714 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6715 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6716 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6717 | spec->num_mixers++; |
| 6718 | } |
| 6719 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6720 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6721 | spec->vmaster_nid = 0x0c; |
| 6722 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6723 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6724 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6725 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6726 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6727 | if (!spec->loopback.amplist) |
| 6728 | spec->loopback.amplist = alc882_loopbacks; |
| 6729 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6730 | |
| 6731 | return 0; |
| 6732 | } |
| 6733 | |
| 6734 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6735 | * ALC883 support |
| 6736 | * |
| 6737 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6738 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6739 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6740 | * 6-channel independent captures. |
| 6741 | * |
| 6742 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6743 | * driver yet). |
| 6744 | */ |
| 6745 | #define ALC883_DIGOUT_NID 0x06 |
| 6746 | #define ALC883_DIGIN_NID 0x0a |
| 6747 | |
| 6748 | static hda_nid_t alc883_dac_nids[4] = { |
| 6749 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6750 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6751 | }; |
| 6752 | |
| 6753 | static hda_nid_t alc883_adc_nids[2] = { |
| 6754 | /* ADC1-2 */ |
| 6755 | 0x08, 0x09, |
| 6756 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6757 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6758 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6759 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6760 | /* input MUX */ |
| 6761 | /* FIXME: should be a matrix-type input source selection */ |
| 6762 | |
| 6763 | static struct hda_input_mux alc883_capture_source = { |
| 6764 | .num_items = 4, |
| 6765 | .items = { |
| 6766 | { "Mic", 0x0 }, |
| 6767 | { "Front Mic", 0x1 }, |
| 6768 | { "Line", 0x2 }, |
| 6769 | { "CD", 0x4 }, |
| 6770 | }, |
| 6771 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6772 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6773 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6774 | .num_items = 4, |
| 6775 | .items = { |
| 6776 | { "Mic", 0x1 }, |
| 6777 | { "Front Mic", 0x0 }, |
| 6778 | { "Line", 0x2 }, |
| 6779 | { "CD", 0x4 }, |
| 6780 | }, |
| 6781 | }; |
| 6782 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6783 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6784 | .num_items = 2, |
| 6785 | .items = { |
| 6786 | { "Mic", 0x1 }, |
| 6787 | { "Line", 0x2 }, |
| 6788 | }, |
| 6789 | }; |
| 6790 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6791 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6792 | .num_items = 4, |
| 6793 | .items = { |
| 6794 | { "Mic", 0x0 }, |
| 6795 | { "iMic", 0x1 }, |
| 6796 | { "Line", 0x2 }, |
| 6797 | { "CD", 0x4 }, |
| 6798 | }, |
| 6799 | }; |
| 6800 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6801 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6802 | .num_items = 2, |
| 6803 | .items = { |
| 6804 | { "Mic", 0x0 }, |
| 6805 | { "Int Mic", 0x1 }, |
| 6806 | }, |
| 6807 | }; |
| 6808 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6809 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6810 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6811 | /* ALC883 has the ALC882-type input selection */ |
| 6812 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6813 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6814 | /* |
| 6815 | * 2ch mode |
| 6816 | */ |
| 6817 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6818 | { 2, NULL } |
| 6819 | }; |
| 6820 | |
| 6821 | /* |
| 6822 | * 2ch mode |
| 6823 | */ |
| 6824 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6825 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6826 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6827 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6828 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6829 | { } /* end */ |
| 6830 | }; |
| 6831 | |
| 6832 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6833 | * 4ch mode |
| 6834 | */ |
| 6835 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6836 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6837 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6838 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6839 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6840 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6841 | { } /* end */ |
| 6842 | }; |
| 6843 | |
| 6844 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6845 | * 6ch mode |
| 6846 | */ |
| 6847 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6848 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6849 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6850 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6851 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6852 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6853 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6854 | { } /* end */ |
| 6855 | }; |
| 6856 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6857 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6858 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6859 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6860 | { 6, alc883_3ST_ch6_init }, |
| 6861 | }; |
| 6862 | |
| 6863 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6864 | * 2ch mode |
| 6865 | */ |
| 6866 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6867 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6868 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6869 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6870 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6871 | { } /* end */ |
| 6872 | }; |
| 6873 | |
| 6874 | /* |
| 6875 | * 4ch mode |
| 6876 | */ |
| 6877 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6878 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6879 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6880 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6881 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6882 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6883 | { } /* end */ |
| 6884 | }; |
| 6885 | |
| 6886 | /* |
| 6887 | * 6ch mode |
| 6888 | */ |
| 6889 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6890 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6891 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6892 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6893 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6894 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6895 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6896 | { } /* end */ |
| 6897 | }; |
| 6898 | |
| 6899 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6900 | { 2, alc883_3ST_ch2_intel_init }, |
| 6901 | { 4, alc883_3ST_ch4_intel_init }, |
| 6902 | { 6, alc883_3ST_ch6_intel_init }, |
| 6903 | }; |
| 6904 | |
| 6905 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6906 | * 6ch mode |
| 6907 | */ |
| 6908 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6909 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6910 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6911 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6912 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6913 | { } /* end */ |
| 6914 | }; |
| 6915 | |
| 6916 | /* |
| 6917 | * 8ch mode |
| 6918 | */ |
| 6919 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6920 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6921 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6922 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6923 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6924 | { } /* end */ |
| 6925 | }; |
| 6926 | |
| 6927 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6928 | { 6, alc883_sixstack_ch6_init }, |
| 6929 | { 8, alc883_sixstack_ch8_init }, |
| 6930 | }; |
| 6931 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6932 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6933 | /* eanable EAPD on medion laptop */ |
| 6934 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6935 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6936 | { } |
| 6937 | }; |
| 6938 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6939 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6940 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6941 | */ |
| 6942 | |
| 6943 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6944 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6945 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6946 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6947 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6948 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6949 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6950 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6951 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6952 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6953 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6954 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6955 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6956 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6957 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6958 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6959 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6960 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6961 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6962 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6963 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6964 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6965 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6966 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6967 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6968 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6969 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6970 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6971 | { |
| 6972 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6973 | /* .name = "Capture Source", */ |
| 6974 | .name = "Input Source", |
| 6975 | .count = 2, |
| 6976 | .info = alc883_mux_enum_info, |
| 6977 | .get = alc883_mux_enum_get, |
| 6978 | .put = alc883_mux_enum_put, |
| 6979 | }, |
| 6980 | { } /* end */ |
| 6981 | }; |
| 6982 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6983 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6984 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6985 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6986 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6987 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6988 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6989 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6990 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6991 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6992 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6993 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6994 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6995 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6996 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6997 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6998 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6999 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7000 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7001 | { |
| 7002 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7003 | /* .name = "Capture Source", */ |
| 7004 | .name = "Input Source", |
| 7005 | .count = 2, |
| 7006 | .info = alc883_mux_enum_info, |
| 7007 | .get = alc883_mux_enum_get, |
| 7008 | .put = alc883_mux_enum_put, |
| 7009 | }, |
| 7010 | { } /* end */ |
| 7011 | }; |
| 7012 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7013 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7014 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7015 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7016 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7017 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7018 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7019 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7021 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7022 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7023 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7024 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7025 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7026 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7027 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7028 | { |
| 7029 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7030 | /* .name = "Capture Source", */ |
| 7031 | .name = "Input Source", |
| 7032 | .count = 2, |
| 7033 | .info = alc883_mux_enum_info, |
| 7034 | .get = alc883_mux_enum_get, |
| 7035 | .put = alc883_mux_enum_put, |
| 7036 | }, |
| 7037 | { } /* end */ |
| 7038 | }; |
| 7039 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7040 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7041 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7042 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7043 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7044 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7045 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7046 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7047 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7048 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7049 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7050 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7051 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7052 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7053 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7054 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7055 | { |
| 7056 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7057 | /* .name = "Capture Source", */ |
| 7058 | .name = "Input Source", |
| 7059 | .count = 2, |
| 7060 | .info = alc883_mux_enum_info, |
| 7061 | .get = alc883_mux_enum_get, |
| 7062 | .put = alc883_mux_enum_put, |
| 7063 | }, |
| 7064 | { } /* end */ |
| 7065 | }; |
| 7066 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7067 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7068 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7069 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7070 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7071 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7072 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7073 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7074 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7075 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7076 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7077 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7078 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7079 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7080 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7081 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7082 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7083 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7084 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7085 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7086 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7087 | { |
| 7088 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7089 | /* .name = "Capture Source", */ |
| 7090 | .name = "Input Source", |
| 7091 | .count = 2, |
| 7092 | .info = alc883_mux_enum_info, |
| 7093 | .get = alc883_mux_enum_get, |
| 7094 | .put = alc883_mux_enum_put, |
| 7095 | }, |
| 7096 | { } /* end */ |
| 7097 | }; |
| 7098 | |
| 7099 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7100 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7101 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7102 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7103 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7104 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7105 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7106 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7107 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7108 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7109 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7110 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7111 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7112 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7113 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7114 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7115 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7116 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7117 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7118 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7119 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7120 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7121 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7122 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7123 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7124 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7125 | { |
| 7126 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7127 | /* .name = "Capture Source", */ |
| 7128 | .name = "Input Source", |
| 7129 | .count = 2, |
| 7130 | .info = alc883_mux_enum_info, |
| 7131 | .get = alc883_mux_enum_get, |
| 7132 | .put = alc883_mux_enum_put, |
| 7133 | }, |
| 7134 | { } /* end */ |
| 7135 | }; |
| 7136 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7137 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7138 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7139 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7140 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7141 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7142 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7143 | HDA_OUTPUT), |
| 7144 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7145 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7146 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7147 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7148 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7149 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7150 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7151 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7152 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7153 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7154 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7155 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7156 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7157 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7158 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7159 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7160 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7161 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7162 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7163 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7164 | { |
| 7165 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7166 | /* .name = "Capture Source", */ |
| 7167 | .name = "Input Source", |
| 7168 | .count = 2, |
| 7169 | .info = alc883_mux_enum_info, |
| 7170 | .get = alc883_mux_enum_get, |
| 7171 | .put = alc883_mux_enum_put, |
| 7172 | }, |
| 7173 | { } /* end */ |
| 7174 | }; |
| 7175 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7176 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7177 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7178 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7179 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7180 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7181 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7182 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7183 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7184 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7185 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7186 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7187 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7188 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7189 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7190 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7191 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7192 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7193 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7194 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7195 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7196 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7197 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7198 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7199 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7200 | |
| 7201 | { |
| 7202 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7203 | /* .name = "Capture Source", */ |
| 7204 | .name = "Input Source", |
| 7205 | .count = 1, |
| 7206 | .info = alc883_mux_enum_info, |
| 7207 | .get = alc883_mux_enum_get, |
| 7208 | .put = alc883_mux_enum_put, |
| 7209 | }, |
| 7210 | { } /* end */ |
| 7211 | }; |
| 7212 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7213 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7214 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7215 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7216 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7217 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7218 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7219 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7220 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7221 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7222 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7223 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7224 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7225 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7226 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7227 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7228 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7229 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7230 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7231 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7232 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7233 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7234 | { |
| 7235 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7236 | /* .name = "Capture Source", */ |
| 7237 | .name = "Input Source", |
| 7238 | .count = 2, |
| 7239 | .info = alc883_mux_enum_info, |
| 7240 | .get = alc883_mux_enum_get, |
| 7241 | .put = alc883_mux_enum_put, |
| 7242 | }, |
| 7243 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7244 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7245 | |
| 7246 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7247 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7248 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7249 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7250 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7251 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7252 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7253 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7254 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7255 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7256 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7257 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7258 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7259 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7260 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7261 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7262 | { |
| 7263 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7264 | /* .name = "Capture Source", */ |
| 7265 | .name = "Input Source", |
| 7266 | .count = 2, |
| 7267 | .info = alc883_mux_enum_info, |
| 7268 | .get = alc883_mux_enum_get, |
| 7269 | .put = alc883_mux_enum_put, |
| 7270 | }, |
| 7271 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7272 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7273 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7274 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7275 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7276 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7277 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7278 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7279 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7280 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7281 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7282 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7283 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7284 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7285 | { |
| 7286 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7287 | /* .name = "Capture Source", */ |
| 7288 | .name = "Input Source", |
| 7289 | .count = 1, |
| 7290 | .info = alc883_mux_enum_info, |
| 7291 | .get = alc883_mux_enum_get, |
| 7292 | .put = alc883_mux_enum_put, |
| 7293 | }, |
| 7294 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7295 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7296 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7297 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7298 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7299 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7300 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7301 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7302 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7303 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7304 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7305 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7306 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7307 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7308 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7309 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7310 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7311 | { |
| 7312 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7313 | /* .name = "Capture Source", */ |
| 7314 | .name = "Input Source", |
| 7315 | .count = 2, |
| 7316 | .info = alc883_mux_enum_info, |
| 7317 | .get = alc883_mux_enum_get, |
| 7318 | .put = alc883_mux_enum_put, |
| 7319 | }, |
| 7320 | { } /* end */ |
| 7321 | }; |
| 7322 | |
| 7323 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7324 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7325 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7326 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7327 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7328 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7329 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7330 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7331 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7332 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7333 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7334 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7335 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7336 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7337 | { |
| 7338 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7339 | /* .name = "Capture Source", */ |
| 7340 | .name = "Input Source", |
| 7341 | .count = 2, |
| 7342 | .info = alc883_mux_enum_info, |
| 7343 | .get = alc883_mux_enum_get, |
| 7344 | .put = alc883_mux_enum_put, |
| 7345 | }, |
| 7346 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7347 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7348 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7349 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7350 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7351 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7352 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7353 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7354 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7355 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7356 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7357 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7358 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7359 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7360 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7361 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7362 | { |
| 7363 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7364 | /* .name = "Capture Source", */ |
| 7365 | .name = "Input Source", |
| 7366 | .count = 2, |
| 7367 | .info = alc883_mux_enum_info, |
| 7368 | .get = alc883_mux_enum_get, |
| 7369 | .put = alc883_mux_enum_put, |
| 7370 | }, |
| 7371 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7372 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7373 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7374 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7375 | { |
| 7376 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7377 | .name = "Channel Mode", |
| 7378 | .info = alc_ch_mode_info, |
| 7379 | .get = alc_ch_mode_get, |
| 7380 | .put = alc_ch_mode_put, |
| 7381 | }, |
| 7382 | { } /* end */ |
| 7383 | }; |
| 7384 | |
| 7385 | static struct hda_verb alc883_init_verbs[] = { |
| 7386 | /* ADC1: mute amp left and right */ |
| 7387 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7388 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7389 | /* ADC2: mute amp left and right */ |
| 7390 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7391 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7392 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7393 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7394 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7395 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7396 | /* Rear mixer */ |
| 7397 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7398 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7399 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7400 | /* CLFE mixer */ |
| 7401 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7402 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7403 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7404 | /* Side mixer */ |
| 7405 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7406 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7407 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7408 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7409 | /* mute analog input loopbacks */ |
| 7410 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7411 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7412 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7413 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7414 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7415 | |
| 7416 | /* Front Pin: output 0 (0x0c) */ |
| 7417 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7418 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7419 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7420 | /* Rear Pin: output 1 (0x0d) */ |
| 7421 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7422 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7423 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7424 | /* CLFE Pin: output 2 (0x0e) */ |
| 7425 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7426 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7427 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7428 | /* Side Pin: output 3 (0x0f) */ |
| 7429 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7430 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7431 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7432 | /* Mic (rear) pin: input vref at 80% */ |
| 7433 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7434 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7435 | /* Front Mic pin: input vref at 80% */ |
| 7436 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7437 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7438 | /* Line In pin: input */ |
| 7439 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7440 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7441 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7442 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7443 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7444 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7445 | /* CD pin widget for input */ |
| 7446 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7447 | |
| 7448 | /* FIXME: use matrix-type input source selection */ |
| 7449 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7450 | /* Input mixer2 */ |
| 7451 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7452 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7453 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7454 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7455 | /* Input mixer3 */ |
| 7456 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7457 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7459 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7460 | { } |
| 7461 | }; |
| 7462 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7463 | /* toggle speaker-output according to the hp-jack state */ |
| 7464 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7465 | { |
| 7466 | unsigned int present; |
| 7467 | |
| 7468 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7469 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7470 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7471 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7472 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7473 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7474 | } |
| 7475 | |
| 7476 | /* auto-toggle front mic */ |
| 7477 | /* |
| 7478 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7479 | { |
| 7480 | unsigned int present; |
| 7481 | unsigned char bits; |
| 7482 | |
| 7483 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7484 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7485 | bits = present ? HDA_AMP_MUTE : 0; |
| 7486 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7487 | } |
| 7488 | */ |
| 7489 | |
| 7490 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7491 | { |
| 7492 | alc883_mitac_hp_automute(codec); |
| 7493 | /* alc883_mitac_mic_automute(codec); */ |
| 7494 | } |
| 7495 | |
| 7496 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7497 | unsigned int res) |
| 7498 | { |
| 7499 | switch (res >> 26) { |
| 7500 | case ALC880_HP_EVENT: |
| 7501 | alc883_mitac_hp_automute(codec); |
| 7502 | break; |
| 7503 | case ALC880_MIC_EVENT: |
| 7504 | /* alc883_mitac_mic_automute(codec); */ |
| 7505 | break; |
| 7506 | } |
| 7507 | } |
| 7508 | |
| 7509 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7510 | /* HP */ |
| 7511 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7512 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7513 | /* Subwoofer */ |
| 7514 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7515 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7516 | |
| 7517 | /* enable unsolicited event */ |
| 7518 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7519 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7520 | |
| 7521 | { } /* end */ |
| 7522 | }; |
| 7523 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7524 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7525 | /* HP */ |
| 7526 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7527 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7528 | /* Int speaker */ |
| 7529 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7530 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7531 | |
| 7532 | /* enable unsolicited event */ |
| 7533 | {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] | 7534 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7535 | |
| 7536 | { } /* end */ |
| 7537 | }; |
| 7538 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7539 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7540 | /* HP */ |
| 7541 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7542 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7543 | /* Subwoofer */ |
| 7544 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7545 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7546 | |
| 7547 | /* enable unsolicited event */ |
| 7548 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7549 | |
| 7550 | { } /* end */ |
| 7551 | }; |
| 7552 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7553 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7554 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7555 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7556 | |
| 7557 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7558 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7559 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7560 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7561 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7562 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7563 | |
| 7564 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7565 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7566 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7567 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7568 | |
| 7569 | { } /* end */ |
| 7570 | }; |
| 7571 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7572 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7573 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7574 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7575 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7576 | { } /* end */ |
| 7577 | }; |
| 7578 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7579 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7580 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7581 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7582 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7583 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7584 | { } /* end */ |
| 7585 | }; |
| 7586 | |
| 7587 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7588 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7589 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7590 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7591 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7592 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7593 | { } /* end */ |
| 7594 | }; |
| 7595 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7596 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7597 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7599 | |
| 7600 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7601 | |
| 7602 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7603 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7604 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7605 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7606 | { } /* end */ |
| 7607 | }; |
| 7608 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7609 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7610 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7611 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7612 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7613 | { } |
| 7614 | }; |
| 7615 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7616 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7617 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7618 | { } |
| 7619 | }; |
| 7620 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7621 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7622 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7623 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7624 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7625 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7626 | { } |
| 7627 | }; |
| 7628 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7629 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7630 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7631 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7632 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7633 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7634 | { } |
| 7635 | }; |
| 7636 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7637 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7638 | { 2, alc888_3st_hp_2ch_init }, |
| 7639 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7640 | }; |
| 7641 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7642 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7643 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7644 | { |
| 7645 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7646 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7647 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7648 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7649 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7650 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7651 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7652 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7653 | } |
| 7654 | |
| 7655 | /* toggle RCA according to the front-jack state */ |
| 7656 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7657 | { |
| 7658 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7659 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7660 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7661 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7662 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7663 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7664 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7665 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7666 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7667 | unsigned int res) |
| 7668 | { |
| 7669 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7670 | alc888_lenovo_ms7195_front_automute(codec); |
| 7671 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7672 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7673 | } |
| 7674 | |
| 7675 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7676 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7677 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7678 | |
| 7679 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7680 | |
| 7681 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7682 | { } /* end */ |
| 7683 | }; |
| 7684 | |
| 7685 | /* toggle speaker-output according to the hp-jack state */ |
| 7686 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7687 | { |
| 7688 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7689 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7690 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7691 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7692 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7693 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7694 | } |
| 7695 | |
| 7696 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7697 | unsigned int res) |
| 7698 | { |
| 7699 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7700 | alc883_medion_md2_automute(codec); |
| 7701 | } |
| 7702 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7703 | /* toggle speaker-output according to the hp-jack state */ |
| 7704 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7705 | { |
| 7706 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7707 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7708 | |
| 7709 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7710 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7711 | bits = present ? HDA_AMP_MUTE : 0; |
| 7712 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7713 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7714 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7715 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7716 | } |
| 7717 | |
| 7718 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7719 | { |
| 7720 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7721 | alc883_tagra_automute(codec); |
| 7722 | } |
| 7723 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7724 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7725 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7726 | { |
| 7727 | unsigned int present; |
| 7728 | unsigned char bits; |
| 7729 | |
| 7730 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7731 | & AC_PINSENSE_PRESENCE; |
| 7732 | bits = present ? HDA_AMP_MUTE : 0; |
| 7733 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7734 | HDA_AMP_MUTE, bits); |
| 7735 | } |
| 7736 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7737 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7738 | { |
| 7739 | unsigned int present; |
| 7740 | |
| 7741 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7742 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7743 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7744 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7745 | } |
| 7746 | |
| 7747 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7748 | { |
| 7749 | alc883_clevo_m720_hp_automute(codec); |
| 7750 | alc883_clevo_m720_mic_automute(codec); |
| 7751 | } |
| 7752 | |
| 7753 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7754 | unsigned int res) |
| 7755 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7756 | switch (res >> 26) { |
| 7757 | case ALC880_HP_EVENT: |
| 7758 | alc883_clevo_m720_hp_automute(codec); |
| 7759 | break; |
| 7760 | case ALC880_MIC_EVENT: |
| 7761 | alc883_clevo_m720_mic_automute(codec); |
| 7762 | break; |
| 7763 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7764 | } |
| 7765 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7766 | /* toggle speaker-output according to the hp-jack state */ |
| 7767 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7768 | { |
| 7769 | unsigned int present; |
| 7770 | unsigned char bits; |
| 7771 | |
| 7772 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7773 | & AC_PINSENSE_PRESENCE; |
| 7774 | bits = present ? HDA_AMP_MUTE : 0; |
| 7775 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7776 | HDA_AMP_MUTE, bits); |
| 7777 | } |
| 7778 | |
| 7779 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7780 | unsigned int res) |
| 7781 | { |
| 7782 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7783 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7784 | } |
| 7785 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7786 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7787 | { |
| 7788 | unsigned int present; |
| 7789 | unsigned char bits; |
| 7790 | |
| 7791 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7792 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7793 | bits = present ? 0x80 : 0; |
| 7794 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7795 | 0x80, bits); |
| 7796 | } |
| 7797 | |
| 7798 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7799 | unsigned int res) |
| 7800 | { |
| 7801 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7802 | alc883_haier_w66_automute(codec); |
| 7803 | } |
| 7804 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7805 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7806 | { |
| 7807 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7808 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7809 | |
| 7810 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7811 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7812 | bits = present ? HDA_AMP_MUTE : 0; |
| 7813 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7814 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7815 | } |
| 7816 | |
| 7817 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7818 | { |
| 7819 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7820 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7821 | |
| 7822 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7823 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7824 | bits = present ? HDA_AMP_MUTE : 0; |
| 7825 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7826 | HDA_AMP_MUTE, bits); |
| 7827 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7828 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7829 | } |
| 7830 | |
| 7831 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7832 | unsigned int res) |
| 7833 | { |
| 7834 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7835 | alc883_lenovo_101e_all_automute(codec); |
| 7836 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7837 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7838 | } |
| 7839 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7840 | /* toggle speaker-output according to the hp-jack state */ |
| 7841 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7842 | { |
| 7843 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7844 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7845 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7846 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7847 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7848 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7849 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7850 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7851 | } |
| 7852 | |
| 7853 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7854 | unsigned int res) |
| 7855 | { |
| 7856 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7857 | alc883_acer_aspire_automute(codec); |
| 7858 | } |
| 7859 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7860 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7861 | /* HP Pin: output 0 (0x0c) */ |
| 7862 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7863 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7864 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7865 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7866 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7867 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7868 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7869 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7870 | /* eanable EAPD on medion laptop */ |
| 7871 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7872 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7873 | /* enable unsolicited event */ |
| 7874 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7875 | { } |
| 7876 | }; |
| 7877 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7878 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7879 | { |
| 7880 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7881 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7882 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7883 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7884 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7885 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7886 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7887 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7888 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7889 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7890 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7891 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7892 | } |
| 7893 | |
| 7894 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7895 | unsigned int res) |
| 7896 | { |
| 7897 | switch (res >> 26) { |
| 7898 | case ALC880_HP_EVENT: |
| 7899 | printk("hp_event\n"); |
| 7900 | alc888_6st_dell_front_automute(codec); |
| 7901 | break; |
| 7902 | } |
| 7903 | } |
| 7904 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7905 | /* |
| 7906 | * generic initialization of ADC, input mixers and output mixers |
| 7907 | */ |
| 7908 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7909 | /* |
| 7910 | * Unmute ADC0-2 and set the default input to mic-in |
| 7911 | */ |
| 7912 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7913 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7914 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7915 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7916 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7917 | /* 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] | 7918 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7919 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7920 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7921 | */ |
| 7922 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7923 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7924 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7925 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7928 | |
| 7929 | /* |
| 7930 | * Set up output mixers (0x0c - 0x0f) |
| 7931 | */ |
| 7932 | /* set vol=0 to output mixers */ |
| 7933 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7934 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7935 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7936 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7937 | /* set up input amps for analog loopback */ |
| 7938 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7939 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7940 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7941 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7942 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7943 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7944 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7945 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7946 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7947 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7948 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7949 | |
| 7950 | /* FIXME: use matrix-type input source selection */ |
| 7951 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7952 | /* Input mixer1 */ |
| 7953 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7954 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7955 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7956 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7957 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7958 | /* Input mixer2 */ |
| 7959 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7960 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7961 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7962 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7963 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7964 | |
| 7965 | { } |
| 7966 | }; |
| 7967 | |
| 7968 | /* capture mixer elements */ |
| 7969 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7970 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7971 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7972 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7973 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7974 | { |
| 7975 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7976 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7977 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7978 | */ |
| 7979 | /* .name = "Capture Source", */ |
| 7980 | .name = "Input Source", |
| 7981 | .count = 2, |
| 7982 | .info = alc882_mux_enum_info, |
| 7983 | .get = alc882_mux_enum_get, |
| 7984 | .put = alc882_mux_enum_put, |
| 7985 | }, |
| 7986 | { } /* end */ |
| 7987 | }; |
| 7988 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7989 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7990 | #define alc883_loopbacks alc880_loopbacks |
| 7991 | #endif |
| 7992 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7993 | /* pcm configuration: identiacal with ALC880 */ |
| 7994 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7995 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7996 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7997 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7998 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7999 | |
| 8000 | /* |
| 8001 | * configuration and preset |
| 8002 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8003 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8004 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8005 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8006 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8007 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8008 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8009 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8010 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8011 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8012 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8013 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8014 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8015 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8016 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8017 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8018 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8019 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8020 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8021 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8022 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8023 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8024 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8025 | [ALC883_AUTO] = "auto", |
| 8026 | }; |
| 8027 | |
| 8028 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8029 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8030 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 8031 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8032 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8033 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8034 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8035 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8036 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8037 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8038 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8039 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8040 | 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] | 8041 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8042 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8043 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8044 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 8045 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8046 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8047 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8048 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8049 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8050 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8051 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8052 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8053 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8054 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8055 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8056 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8057 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8058 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8059 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8060 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8061 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8062 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8063 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8064 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8065 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8066 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8067 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8068 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8069 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8070 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8071 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8072 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8073 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8074 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8075 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8076 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8077 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8078 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8079 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8080 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8081 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8082 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8083 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8084 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8085 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8086 | {} |
| 8087 | }; |
| 8088 | |
| 8089 | static struct alc_config_preset alc883_presets[] = { |
| 8090 | [ALC883_3ST_2ch_DIG] = { |
| 8091 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8092 | .init_verbs = { alc883_init_verbs }, |
| 8093 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8094 | .dac_nids = alc883_dac_nids, |
| 8095 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8096 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8097 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8098 | .channel_mode = alc883_3ST_2ch_modes, |
| 8099 | .input_mux = &alc883_capture_source, |
| 8100 | }, |
| 8101 | [ALC883_3ST_6ch_DIG] = { |
| 8102 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8103 | .init_verbs = { alc883_init_verbs }, |
| 8104 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8105 | .dac_nids = alc883_dac_nids, |
| 8106 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8107 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8108 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8109 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8110 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8111 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8112 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8113 | [ALC883_3ST_6ch] = { |
| 8114 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8115 | .init_verbs = { alc883_init_verbs }, |
| 8116 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8117 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8118 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8119 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8120 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8121 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8122 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8123 | [ALC883_3ST_6ch_INTEL] = { |
| 8124 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8125 | .init_verbs = { alc883_init_verbs }, |
| 8126 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8127 | .dac_nids = alc883_dac_nids, |
| 8128 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8129 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8130 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8131 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8132 | .need_dac_fix = 1, |
| 8133 | .input_mux = &alc883_3stack_6ch_intel, |
| 8134 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8135 | [ALC883_6ST_DIG] = { |
| 8136 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8137 | .init_verbs = { alc883_init_verbs }, |
| 8138 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8139 | .dac_nids = alc883_dac_nids, |
| 8140 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8141 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8142 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8143 | .channel_mode = alc883_sixstack_modes, |
| 8144 | .input_mux = &alc883_capture_source, |
| 8145 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8146 | [ALC883_TARGA_DIG] = { |
| 8147 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8148 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8149 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8150 | .dac_nids = alc883_dac_nids, |
| 8151 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8152 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8153 | .channel_mode = alc883_3ST_6ch_modes, |
| 8154 | .need_dac_fix = 1, |
| 8155 | .input_mux = &alc883_capture_source, |
| 8156 | .unsol_event = alc883_tagra_unsol_event, |
| 8157 | .init_hook = alc883_tagra_automute, |
| 8158 | }, |
| 8159 | [ALC883_TARGA_2ch_DIG] = { |
| 8160 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8161 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8162 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8163 | .dac_nids = alc883_dac_nids, |
| 8164 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8165 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8166 | .channel_mode = alc883_3ST_2ch_modes, |
| 8167 | .input_mux = &alc883_capture_source, |
| 8168 | .unsol_event = alc883_tagra_unsol_event, |
| 8169 | .init_hook = alc883_tagra_automute, |
| 8170 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8171 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8172 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8173 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8174 | * and the headphone jack. Turn this on and rely on the |
| 8175 | * standard mute methods whenever the user wants to turn |
| 8176 | * these outputs off. |
| 8177 | */ |
| 8178 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8179 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8180 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8181 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8182 | .channel_mode = alc883_3ST_2ch_modes, |
| 8183 | .input_mux = &alc883_capture_source, |
| 8184 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8185 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8186 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8187 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8188 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8189 | .dac_nids = alc883_dac_nids, |
| 8190 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8191 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8192 | .channel_mode = alc883_3ST_2ch_modes, |
| 8193 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8194 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8195 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8196 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8197 | [ALC883_MEDION] = { |
| 8198 | .mixers = { alc883_fivestack_mixer, |
| 8199 | alc883_chmode_mixer }, |
| 8200 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8201 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8202 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8203 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8204 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8205 | .channel_mode = alc883_sixstack_modes, |
| 8206 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8207 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8208 | [ALC883_MEDION_MD2] = { |
| 8209 | .mixers = { alc883_medion_md2_mixer}, |
| 8210 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8211 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8212 | .dac_nids = alc883_dac_nids, |
| 8213 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8214 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8215 | .channel_mode = alc883_3ST_2ch_modes, |
| 8216 | .input_mux = &alc883_capture_source, |
| 8217 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8218 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8219 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8220 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8221 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8222 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8223 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8224 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8225 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8226 | .channel_mode = alc883_3ST_2ch_modes, |
| 8227 | .input_mux = &alc883_capture_source, |
| 8228 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8229 | [ALC883_CLEVO_M720] = { |
| 8230 | .mixers = { alc883_clevo_m720_mixer }, |
| 8231 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8232 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8233 | .dac_nids = alc883_dac_nids, |
| 8234 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8235 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8236 | .channel_mode = alc883_3ST_2ch_modes, |
| 8237 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8238 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8239 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8240 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8241 | [ALC883_LENOVO_101E_2ch] = { |
| 8242 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8243 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8244 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8245 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8246 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8247 | .channel_mode = alc883_3ST_2ch_modes, |
| 8248 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8249 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8250 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8251 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8252 | [ALC883_LENOVO_NB0763] = { |
| 8253 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8254 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8255 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8256 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8257 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8258 | .channel_mode = alc883_3ST_2ch_modes, |
| 8259 | .need_dac_fix = 1, |
| 8260 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8261 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8262 | .init_hook = alc883_medion_md2_automute, |
| 8263 | }, |
| 8264 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8265 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8266 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8267 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8268 | .dac_nids = alc883_dac_nids, |
| 8269 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8270 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8271 | .channel_mode = alc883_3ST_6ch_modes, |
| 8272 | .need_dac_fix = 1, |
| 8273 | .input_mux = &alc883_capture_source, |
| 8274 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8275 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8276 | }, |
| 8277 | [ALC883_HAIER_W66] = { |
| 8278 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8279 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8280 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8281 | .dac_nids = alc883_dac_nids, |
| 8282 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8283 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8284 | .channel_mode = alc883_3ST_2ch_modes, |
| 8285 | .input_mux = &alc883_capture_source, |
| 8286 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8287 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8288 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8289 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8290 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8291 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8292 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8293 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8294 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8295 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8296 | .need_dac_fix = 1, |
| 8297 | .input_mux = &alc883_capture_source, |
| 8298 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8299 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8300 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8301 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8302 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8303 | .dac_nids = alc883_dac_nids, |
| 8304 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8305 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8306 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8307 | .channel_mode = alc883_sixstack_modes, |
| 8308 | .input_mux = &alc883_capture_source, |
| 8309 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8310 | .init_hook = alc888_6st_dell_front_automute, |
| 8311 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8312 | [ALC883_MITAC] = { |
| 8313 | .mixers = { alc883_mitac_mixer }, |
| 8314 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8315 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8316 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8317 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8318 | .channel_mode = alc883_3ST_2ch_modes, |
| 8319 | .input_mux = &alc883_capture_source, |
| 8320 | .unsol_event = alc883_mitac_unsol_event, |
| 8321 | .init_hook = alc883_mitac_automute, |
| 8322 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8323 | [ALC883_FUJITSU_PI2515] = { |
| 8324 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8325 | .init_verbs = { alc883_init_verbs, |
| 8326 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8327 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8328 | .dac_nids = alc883_dac_nids, |
| 8329 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8330 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8331 | .channel_mode = alc883_3ST_2ch_modes, |
| 8332 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8333 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8334 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8335 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8336 | }; |
| 8337 | |
| 8338 | |
| 8339 | /* |
| 8340 | * BIOS auto configuration |
| 8341 | */ |
| 8342 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8343 | hda_nid_t nid, int pin_type, |
| 8344 | int dac_idx) |
| 8345 | { |
| 8346 | /* set as output */ |
| 8347 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8348 | int idx; |
| 8349 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8350 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8351 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8352 | idx = 4; |
| 8353 | else |
| 8354 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8355 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8356 | |
| 8357 | } |
| 8358 | |
| 8359 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8360 | { |
| 8361 | struct alc_spec *spec = codec->spec; |
| 8362 | int i; |
| 8363 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8364 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8365 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8366 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8367 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8368 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8369 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8370 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8371 | } |
| 8372 | } |
| 8373 | |
| 8374 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8375 | { |
| 8376 | struct alc_spec *spec = codec->spec; |
| 8377 | hda_nid_t pin; |
| 8378 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8379 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8380 | if (pin) /* connect to front */ |
| 8381 | /* use dac 0 */ |
| 8382 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8383 | pin = spec->autocfg.speaker_pins[0]; |
| 8384 | if (pin) |
| 8385 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8386 | } |
| 8387 | |
| 8388 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8389 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8390 | |
| 8391 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8392 | { |
| 8393 | struct alc_spec *spec = codec->spec; |
| 8394 | int i; |
| 8395 | |
| 8396 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8397 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8398 | if (alc883_is_input_pin(nid)) { |
| 8399 | snd_hda_codec_write(codec, nid, 0, |
| 8400 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8401 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8402 | PIN_VREF80 : PIN_IN)); |
| 8403 | if (nid != ALC883_PIN_CD_NID) |
| 8404 | snd_hda_codec_write(codec, nid, 0, |
| 8405 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8406 | AMP_OUT_MUTE); |
| 8407 | } |
| 8408 | } |
| 8409 | } |
| 8410 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8411 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 8412 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8413 | /* almost identical with ALC880 parser... */ |
| 8414 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8415 | { |
| 8416 | struct alc_spec *spec = codec->spec; |
| 8417 | int err = alc880_parse_auto_config(codec); |
| 8418 | |
| 8419 | if (err < 0) |
| 8420 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8421 | else if (!err) |
| 8422 | return 0; /* no config found */ |
| 8423 | |
| 8424 | err = alc_auto_add_mic_boost(codec); |
| 8425 | if (err < 0) |
| 8426 | return err; |
| 8427 | |
| 8428 | /* hack - override the init verbs */ |
| 8429 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8430 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8431 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8432 | |
| 8433 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8434 | } |
| 8435 | |
| 8436 | /* additional initialization for auto-configuration model */ |
| 8437 | static void alc883_auto_init(struct hda_codec *codec) |
| 8438 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8439 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8440 | alc883_auto_init_multi_out(codec); |
| 8441 | alc883_auto_init_hp_out(codec); |
| 8442 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8443 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8444 | if (spec->unsol_event) |
| 8445 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8446 | } |
| 8447 | |
| 8448 | static int patch_alc883(struct hda_codec *codec) |
| 8449 | { |
| 8450 | struct alc_spec *spec; |
| 8451 | int err, board_config; |
| 8452 | |
| 8453 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8454 | if (spec == NULL) |
| 8455 | return -ENOMEM; |
| 8456 | |
| 8457 | codec->spec = spec; |
| 8458 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 8459 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 8460 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8461 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8462 | alc883_models, |
| 8463 | alc883_cfg_tbl); |
| 8464 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8465 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8466 | "trying auto-probe from BIOS...\n"); |
| 8467 | board_config = ALC883_AUTO; |
| 8468 | } |
| 8469 | |
| 8470 | if (board_config == ALC883_AUTO) { |
| 8471 | /* automatic parse from the BIOS config */ |
| 8472 | err = alc883_parse_auto_config(codec); |
| 8473 | if (err < 0) { |
| 8474 | alc_free(codec); |
| 8475 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8476 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8477 | printk(KERN_INFO |
| 8478 | "hda_codec: Cannot set up configuration " |
| 8479 | "from BIOS. Using base mode...\n"); |
| 8480 | board_config = ALC883_3ST_2ch_DIG; |
| 8481 | } |
| 8482 | } |
| 8483 | |
| 8484 | if (board_config != ALC883_AUTO) |
| 8485 | setup_preset(spec, &alc883_presets[board_config]); |
| 8486 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8487 | switch (codec->vendor_id) { |
| 8488 | case 0x10ec0888: |
| 8489 | spec->stream_name_analog = "ALC888 Analog"; |
| 8490 | spec->stream_name_digital = "ALC888 Digital"; |
| 8491 | break; |
| 8492 | case 0x10ec0889: |
| 8493 | spec->stream_name_analog = "ALC889 Analog"; |
| 8494 | spec->stream_name_digital = "ALC889 Digital"; |
| 8495 | break; |
| 8496 | default: |
| 8497 | spec->stream_name_analog = "ALC883 Analog"; |
| 8498 | spec->stream_name_digital = "ALC883 Digital"; |
| 8499 | break; |
| 8500 | } |
| 8501 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8502 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8503 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8504 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8505 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8506 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8507 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8508 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8509 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8510 | spec->adc_nids = alc883_adc_nids; |
| 8511 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8512 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8513 | spec->vmaster_nid = 0x0c; |
| 8514 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8515 | codec->patch_ops = alc_patch_ops; |
| 8516 | if (board_config == ALC883_AUTO) |
| 8517 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 8518 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8519 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8520 | if (!spec->loopback.amplist) |
| 8521 | spec->loopback.amplist = alc883_loopbacks; |
| 8522 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8523 | |
| 8524 | return 0; |
| 8525 | } |
| 8526 | |
| 8527 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8528 | * ALC262 support |
| 8529 | */ |
| 8530 | |
| 8531 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8532 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8533 | |
| 8534 | #define alc262_dac_nids alc260_dac_nids |
| 8535 | #define alc262_adc_nids alc882_adc_nids |
| 8536 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8537 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8538 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8539 | |
| 8540 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8541 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8542 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame^] | 8543 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 8544 | /* ADC0 */ |
| 8545 | 0x09 |
| 8546 | }; |
| 8547 | |
| 8548 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 8549 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8550 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8551 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8552 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8553 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8554 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8555 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8556 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8557 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8558 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8559 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8560 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8561 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8562 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8563 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8564 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8565 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8566 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8567 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8568 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8569 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8570 | }; |
| 8571 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8572 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8573 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8574 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8575 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8576 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8577 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8578 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8579 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8580 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8581 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8582 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8583 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8584 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8585 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8586 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8587 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8588 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8589 | { } /* end */ |
| 8590 | }; |
| 8591 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8592 | /* update HP, line and mono-out pins according to the master switch */ |
| 8593 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8594 | { |
| 8595 | struct alc_spec *spec = codec->spec; |
| 8596 | int val = spec->master_sw; |
| 8597 | |
| 8598 | /* HP & line-out */ |
| 8599 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8600 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8601 | val ? PIN_HP : 0); |
| 8602 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8603 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8604 | val ? PIN_HP : 0); |
| 8605 | /* mono (speaker) depending on the HP jack sense */ |
| 8606 | val = val && !spec->jack_present; |
| 8607 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8608 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8609 | val ? PIN_OUT : 0); |
| 8610 | } |
| 8611 | |
| 8612 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8613 | { |
| 8614 | struct alc_spec *spec = codec->spec; |
| 8615 | unsigned int presence; |
| 8616 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8617 | AC_VERB_GET_PIN_SENSE, 0); |
| 8618 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8619 | alc262_hp_master_update(codec); |
| 8620 | } |
| 8621 | |
| 8622 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8623 | { |
| 8624 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8625 | return; |
| 8626 | alc262_hp_bpc_automute(codec); |
| 8627 | } |
| 8628 | |
| 8629 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8630 | { |
| 8631 | struct alc_spec *spec = codec->spec; |
| 8632 | unsigned int presence; |
| 8633 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8634 | AC_VERB_GET_PIN_SENSE, 0); |
| 8635 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8636 | alc262_hp_master_update(codec); |
| 8637 | } |
| 8638 | |
| 8639 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8640 | unsigned int res) |
| 8641 | { |
| 8642 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8643 | return; |
| 8644 | alc262_hp_wildwest_automute(codec); |
| 8645 | } |
| 8646 | |
| 8647 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8648 | struct snd_ctl_elem_value *ucontrol) |
| 8649 | { |
| 8650 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8651 | struct alc_spec *spec = codec->spec; |
| 8652 | *ucontrol->value.integer.value = spec->master_sw; |
| 8653 | return 0; |
| 8654 | } |
| 8655 | |
| 8656 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8657 | struct snd_ctl_elem_value *ucontrol) |
| 8658 | { |
| 8659 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8660 | struct alc_spec *spec = codec->spec; |
| 8661 | int val = !!*ucontrol->value.integer.value; |
| 8662 | |
| 8663 | if (val == spec->master_sw) |
| 8664 | return 0; |
| 8665 | spec->master_sw = val; |
| 8666 | alc262_hp_master_update(codec); |
| 8667 | return 1; |
| 8668 | } |
| 8669 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8670 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8671 | { |
| 8672 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8673 | .name = "Master Playback Switch", |
| 8674 | .info = snd_ctl_boolean_mono_info, |
| 8675 | .get = alc262_hp_master_sw_get, |
| 8676 | .put = alc262_hp_master_sw_put, |
| 8677 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8678 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8679 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8680 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8681 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8682 | HDA_OUTPUT), |
| 8683 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8684 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8685 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8686 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8687 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8688 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8689 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8690 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8691 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8692 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8693 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8694 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8695 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8696 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8697 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8698 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8699 | { } /* end */ |
| 8700 | }; |
| 8701 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8702 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8703 | { |
| 8704 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8705 | .name = "Master Playback Switch", |
| 8706 | .info = snd_ctl_boolean_mono_info, |
| 8707 | .get = alc262_hp_master_sw_get, |
| 8708 | .put = alc262_hp_master_sw_put, |
| 8709 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8710 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8711 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8712 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8713 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8714 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8715 | HDA_OUTPUT), |
| 8716 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8717 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8718 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8719 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8720 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8721 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8722 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8723 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8724 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8725 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8726 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8727 | { } /* end */ |
| 8728 | }; |
| 8729 | |
| 8730 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8731 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8732 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8733 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8734 | { } /* end */ |
| 8735 | }; |
| 8736 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8737 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8738 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8739 | { |
| 8740 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8741 | |
| 8742 | if (force || !spec->sense_updated) { |
| 8743 | unsigned int present; |
| 8744 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8745 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8746 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8747 | spec->sense_updated = 1; |
| 8748 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8749 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8750 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8751 | } |
| 8752 | |
| 8753 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8754 | unsigned int res) |
| 8755 | { |
| 8756 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8757 | return; |
| 8758 | alc262_hp_t5735_automute(codec, 1); |
| 8759 | } |
| 8760 | |
| 8761 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8762 | { |
| 8763 | alc262_hp_t5735_automute(codec, 1); |
| 8764 | } |
| 8765 | |
| 8766 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8767 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8768 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8769 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8770 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8771 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8772 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8773 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8774 | { } /* end */ |
| 8775 | }; |
| 8776 | |
| 8777 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8778 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8779 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8780 | |
| 8781 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8782 | { } |
| 8783 | }; |
| 8784 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8785 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8786 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8787 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8788 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8789 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8790 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8791 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8792 | { } /* end */ |
| 8793 | }; |
| 8794 | |
| 8795 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8796 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8797 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8798 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8799 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8800 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8801 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8802 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8803 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8804 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8805 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8806 | {} |
| 8807 | }; |
| 8808 | |
| 8809 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8810 | .num_items = 1, |
| 8811 | .items = { |
| 8812 | { "Line", 0x1 }, |
| 8813 | }, |
| 8814 | }; |
| 8815 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8816 | /* bind hp and internal speaker mute (with plug check) */ |
| 8817 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8818 | struct snd_ctl_elem_value *ucontrol) |
| 8819 | { |
| 8820 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8821 | long *valp = ucontrol->value.integer.value; |
| 8822 | int change; |
| 8823 | |
| 8824 | /* change hp mute */ |
| 8825 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8826 | HDA_AMP_MUTE, |
| 8827 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8828 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8829 | HDA_AMP_MUTE, |
| 8830 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8831 | if (change) { |
| 8832 | /* change speaker according to HP jack state */ |
| 8833 | struct alc_spec *spec = codec->spec; |
| 8834 | unsigned int mute; |
| 8835 | if (spec->jack_present) |
| 8836 | mute = HDA_AMP_MUTE; |
| 8837 | else |
| 8838 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8839 | HDA_OUTPUT, 0); |
| 8840 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8841 | HDA_AMP_MUTE, mute); |
| 8842 | } |
| 8843 | return change; |
| 8844 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8845 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8846 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8847 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8848 | { |
| 8849 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8850 | .name = "Master Playback Switch", |
| 8851 | .info = snd_hda_mixer_amp_switch_info, |
| 8852 | .get = snd_hda_mixer_amp_switch_get, |
| 8853 | .put = alc262_sony_master_sw_put, |
| 8854 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8855 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8856 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8857 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8858 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8859 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8860 | { } /* end */ |
| 8861 | }; |
| 8862 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8863 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8864 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8865 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8866 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8869 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8870 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8871 | { } /* end */ |
| 8872 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8873 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8874 | #define alc262_capture_mixer alc882_capture_mixer |
| 8875 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8876 | |
| 8877 | /* |
| 8878 | * generic initialization of ADC, input mixers and output mixers |
| 8879 | */ |
| 8880 | static struct hda_verb alc262_init_verbs[] = { |
| 8881 | /* |
| 8882 | * Unmute ADC0-2 and set the default input to mic-in |
| 8883 | */ |
| 8884 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8885 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8886 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8887 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8888 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8889 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8890 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8891 | /* 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] | 8892 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8893 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8894 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8895 | */ |
| 8896 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8897 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8898 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8899 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8900 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8901 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8902 | |
| 8903 | /* |
| 8904 | * Set up output mixers (0x0c - 0x0e) |
| 8905 | */ |
| 8906 | /* set vol=0 to output mixers */ |
| 8907 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8908 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8909 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8910 | /* set up input amps for analog loopback */ |
| 8911 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8912 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8913 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8914 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8915 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8916 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8917 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8918 | |
| 8919 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8920 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8921 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8922 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8923 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8924 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8925 | |
| 8926 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8927 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8928 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8929 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8930 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8931 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8932 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8933 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8934 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8935 | /* FIXME: use matrix-type input source selection */ |
| 8936 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8937 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8938 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8939 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8940 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8941 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8942 | /* Input mixer2 */ |
| 8943 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8944 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8945 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8946 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8947 | /* Input mixer3 */ |
| 8948 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8949 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8950 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8951 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8952 | |
| 8953 | { } |
| 8954 | }; |
| 8955 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame^] | 8956 | static struct hda_verb alc262_eapd_verbs[] = { |
| 8957 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8958 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8959 | { } |
| 8960 | }; |
| 8961 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8962 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8963 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8964 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8965 | {} |
| 8966 | }; |
| 8967 | |
| 8968 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8969 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8970 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8971 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8972 | |
| 8973 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8974 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8975 | {} |
| 8976 | }; |
| 8977 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8978 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8979 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8980 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8981 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8982 | |
| 8983 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8984 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 8985 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8986 | }; |
| 8987 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame^] | 8988 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 8989 | .num_items = 2, |
| 8990 | .items = { |
| 8991 | { "Int DMic", 0x9 }, |
| 8992 | { "Mic", 0x0 }, |
| 8993 | }, |
| 8994 | }; |
| 8995 | |
| 8996 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 8997 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8998 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8999 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9001 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9002 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9003 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9004 | { |
| 9005 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9006 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9007 | * So call somewhat different.. |
| 9008 | */ |
| 9009 | /* .name = "Capture Source", */ |
| 9010 | .name = "Input Source", |
| 9011 | .count = 1, |
| 9012 | .info = alc_mux_enum_info, |
| 9013 | .get = alc_mux_enum_get, |
| 9014 | .put = alc_mux_enum_put, |
| 9015 | }, |
| 9016 | { } /* end */ |
| 9017 | }; |
| 9018 | |
| 9019 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9020 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9021 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9022 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9023 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9024 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9025 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9026 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9027 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9028 | {} |
| 9029 | }; |
| 9030 | |
| 9031 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9032 | { |
| 9033 | unsigned int present; |
| 9034 | |
| 9035 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9036 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9037 | snd_hda_codec_write(codec, 0x22, 0, |
| 9038 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9039 | } |
| 9040 | |
| 9041 | /* toggle speaker-output according to the hp-jack state */ |
| 9042 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9043 | { |
| 9044 | unsigned int present; |
| 9045 | unsigned char bits; |
| 9046 | |
| 9047 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9048 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9049 | bits = present ? 0 : PIN_OUT; |
| 9050 | snd_hda_codec_write(codec, 0x14, 0, |
| 9051 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9052 | } |
| 9053 | |
| 9054 | |
| 9055 | |
| 9056 | /* unsolicited event for HP jack sensing */ |
| 9057 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9058 | unsigned int res) |
| 9059 | { |
| 9060 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9061 | alc262_toshiba_s06_speaker_automute(codec); |
| 9062 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9063 | alc262_dmic_automute(codec); |
| 9064 | |
| 9065 | } |
| 9066 | |
| 9067 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9068 | { |
| 9069 | alc262_toshiba_s06_speaker_automute(codec); |
| 9070 | alc262_dmic_automute(codec); |
| 9071 | } |
| 9072 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9073 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9074 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9075 | { |
| 9076 | struct alc_spec *spec = codec->spec; |
| 9077 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9078 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9079 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9080 | /* need to execute and sync at first */ |
| 9081 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9082 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9083 | AC_VERB_GET_PIN_SENSE, 0); |
| 9084 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9085 | if (spec->jack_present) { |
| 9086 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9087 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9088 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9089 | } else { |
| 9090 | /* unmute internal speaker if necessary */ |
| 9091 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9092 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9093 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9094 | } |
| 9095 | } |
| 9096 | |
| 9097 | /* unsolicited event for HP jack sensing */ |
| 9098 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9099 | unsigned int res) |
| 9100 | { |
| 9101 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9102 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9103 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9104 | } |
| 9105 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9106 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9107 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9108 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9109 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9110 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9111 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9112 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9113 | AC_VERB_GET_PIN_SENSE, 0); |
| 9114 | present = (present & 0x80000000) != 0; |
| 9115 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9116 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9117 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9118 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9119 | } else { |
| 9120 | /* unmute internal speaker if necessary */ |
| 9121 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9122 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9123 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9124 | } |
| 9125 | } |
| 9126 | |
| 9127 | /* unsolicited event for HP jack sensing */ |
| 9128 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9129 | unsigned int res) |
| 9130 | { |
| 9131 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9132 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9133 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9134 | } |
| 9135 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9136 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9137 | * nec model |
| 9138 | * 0x15 = headphone |
| 9139 | * 0x16 = internal speaker |
| 9140 | * 0x18 = external mic |
| 9141 | */ |
| 9142 | |
| 9143 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9144 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9145 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9146 | |
| 9147 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9148 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9149 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9150 | |
| 9151 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9152 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9153 | { } /* end */ |
| 9154 | }; |
| 9155 | |
| 9156 | static struct hda_verb alc262_nec_verbs[] = { |
| 9157 | /* Unmute Speaker */ |
| 9158 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9159 | |
| 9160 | /* Headphone */ |
| 9161 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9162 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9163 | |
| 9164 | /* External mic to headphone */ |
| 9165 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9166 | /* External mic to speaker */ |
| 9167 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9168 | {} |
| 9169 | }; |
| 9170 | |
| 9171 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9172 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9173 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9174 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9175 | */ |
| 9176 | |
| 9177 | #define ALC_HP_EVENT 0x37 |
| 9178 | |
| 9179 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9180 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9181 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9182 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9183 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9184 | {} |
| 9185 | }; |
| 9186 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9187 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9188 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9189 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9190 | {} |
| 9191 | }; |
| 9192 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9193 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9194 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9195 | .items = { |
| 9196 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9197 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9198 | { "CD", 0x4 }, |
| 9199 | }, |
| 9200 | }; |
| 9201 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9202 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9203 | .num_items = 5, |
| 9204 | .items = { |
| 9205 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9206 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9207 | { "Line", 0x2 }, |
| 9208 | { "CD", 0x4 }, |
| 9209 | { "AUX IN", 0x6 }, |
| 9210 | }, |
| 9211 | }; |
| 9212 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9213 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9214 | .num_items = 4, |
| 9215 | .items = { |
| 9216 | { "Mic", 0x0 }, |
| 9217 | { "Front Mic", 0x2 }, |
| 9218 | { "Line", 0x1 }, |
| 9219 | { "CD", 0x4 }, |
| 9220 | }, |
| 9221 | }; |
| 9222 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9223 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9224 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9225 | { |
| 9226 | struct alc_spec *spec = codec->spec; |
| 9227 | unsigned int mute; |
| 9228 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9229 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9230 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9231 | /* need to execute and sync at first */ |
| 9232 | 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] | 9233 | /* check laptop HP jack */ |
| 9234 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9235 | AC_VERB_GET_PIN_SENSE, 0); |
| 9236 | /* need to execute and sync at first */ |
| 9237 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9238 | /* check docking HP jack */ |
| 9239 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9240 | AC_VERB_GET_PIN_SENSE, 0); |
| 9241 | if (present & AC_PINSENSE_PRESENCE) |
| 9242 | spec->jack_present = 1; |
| 9243 | else |
| 9244 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9245 | spec->sense_updated = 1; |
| 9246 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9247 | /* unmute internal speaker only if both HPs are unplugged and |
| 9248 | * master switch is on |
| 9249 | */ |
| 9250 | if (spec->jack_present) |
| 9251 | mute = HDA_AMP_MUTE; |
| 9252 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9253 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9254 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9255 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9256 | } |
| 9257 | |
| 9258 | /* unsolicited event for HP jack sensing */ |
| 9259 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9260 | unsigned int res) |
| 9261 | { |
| 9262 | if ((res >> 26) != ALC_HP_EVENT) |
| 9263 | return; |
| 9264 | alc262_fujitsu_automute(codec, 1); |
| 9265 | } |
| 9266 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9267 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9268 | { |
| 9269 | alc262_fujitsu_automute(codec, 1); |
| 9270 | } |
| 9271 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9272 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9273 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 9274 | .ops = &snd_hda_bind_vol, |
| 9275 | .values = { |
| 9276 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 9277 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 9278 | 0 |
| 9279 | }, |
| 9280 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9281 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9282 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9283 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 9284 | { |
| 9285 | struct alc_spec *spec = codec->spec; |
| 9286 | unsigned int mute; |
| 9287 | |
| 9288 | if (force || !spec->sense_updated) { |
| 9289 | unsigned int present_int_hp; |
| 9290 | /* need to execute and sync at first */ |
| 9291 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9292 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 9293 | AC_VERB_GET_PIN_SENSE, 0); |
| 9294 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 9295 | spec->sense_updated = 1; |
| 9296 | } |
| 9297 | if (spec->jack_present) { |
| 9298 | /* mute internal speaker */ |
| 9299 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9300 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9301 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9302 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9303 | } else { |
| 9304 | /* unmute internal speaker if necessary */ |
| 9305 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9306 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9307 | HDA_AMP_MUTE, mute); |
| 9308 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9309 | HDA_AMP_MUTE, mute); |
| 9310 | } |
| 9311 | } |
| 9312 | |
| 9313 | /* unsolicited event for HP jack sensing */ |
| 9314 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 9315 | unsigned int res) |
| 9316 | { |
| 9317 | if ((res >> 26) != ALC_HP_EVENT) |
| 9318 | return; |
| 9319 | alc262_lenovo_3000_automute(codec, 1); |
| 9320 | } |
| 9321 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9322 | /* bind hp and internal speaker mute (with plug check) */ |
| 9323 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9324 | struct snd_ctl_elem_value *ucontrol) |
| 9325 | { |
| 9326 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9327 | long *valp = ucontrol->value.integer.value; |
| 9328 | int change; |
| 9329 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9330 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9331 | HDA_AMP_MUTE, |
| 9332 | valp ? 0 : HDA_AMP_MUTE); |
| 9333 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9334 | HDA_AMP_MUTE, |
| 9335 | valp ? 0 : HDA_AMP_MUTE); |
| 9336 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 9337 | if (change) |
| 9338 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9339 | return change; |
| 9340 | } |
| 9341 | |
| 9342 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9343 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9344 | { |
| 9345 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9346 | .name = "Master Playback Switch", |
| 9347 | .info = snd_hda_mixer_amp_switch_info, |
| 9348 | .get = snd_hda_mixer_amp_switch_get, |
| 9349 | .put = alc262_fujitsu_master_sw_put, |
| 9350 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9351 | }, |
| 9352 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9353 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 9354 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 9355 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9356 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9357 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9358 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9359 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9360 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9361 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9362 | { } /* end */ |
| 9363 | }; |
| 9364 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9365 | /* bind hp and internal speaker mute (with plug check) */ |
| 9366 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9367 | struct snd_ctl_elem_value *ucontrol) |
| 9368 | { |
| 9369 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9370 | long *valp = ucontrol->value.integer.value; |
| 9371 | int change; |
| 9372 | |
| 9373 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9374 | HDA_AMP_MUTE, |
| 9375 | valp ? 0 : HDA_AMP_MUTE); |
| 9376 | |
| 9377 | if (change) |
| 9378 | alc262_lenovo_3000_automute(codec, 0); |
| 9379 | return change; |
| 9380 | } |
| 9381 | |
| 9382 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 9383 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9384 | { |
| 9385 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9386 | .name = "Master Playback Switch", |
| 9387 | .info = snd_hda_mixer_amp_switch_info, |
| 9388 | .get = snd_hda_mixer_amp_switch_get, |
| 9389 | .put = alc262_lenovo_3000_master_sw_put, |
| 9390 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 9391 | }, |
| 9392 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9393 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9394 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9395 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9396 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9397 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9398 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9399 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9400 | { } /* end */ |
| 9401 | }; |
| 9402 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9403 | /* additional init verbs for Benq laptops */ |
| 9404 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 9405 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9406 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9407 | {} |
| 9408 | }; |
| 9409 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9410 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 9411 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9412 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9413 | |
| 9414 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9415 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 9416 | {} |
| 9417 | }; |
| 9418 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9419 | /* Samsung Q1 Ultra Vista model setup */ |
| 9420 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9421 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9422 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9423 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9424 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9425 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9426 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9427 | { } /* end */ |
| 9428 | }; |
| 9429 | |
| 9430 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9431 | /* output mixer */ |
| 9432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9433 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9434 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9435 | /* speaker */ |
| 9436 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9437 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9438 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9439 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9440 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9441 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9442 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9443 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9444 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9445 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9446 | /* internal mic */ |
| 9447 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9448 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9449 | /* ADC, choose mic */ |
| 9450 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9451 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9452 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9453 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9454 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9455 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9456 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9457 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9458 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 9459 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9460 | {} |
| 9461 | }; |
| 9462 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9463 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9464 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9465 | { |
| 9466 | struct alc_spec *spec = codec->spec; |
| 9467 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9468 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9469 | mute = 0; |
| 9470 | /* auto-mute only when HP is used as HP */ |
| 9471 | if (!spec->cur_mux[0]) { |
| 9472 | unsigned int present; |
| 9473 | /* need to execute and sync at first */ |
| 9474 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9475 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9476 | AC_VERB_GET_PIN_SENSE, 0); |
| 9477 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9478 | if (spec->jack_present) |
| 9479 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9480 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9481 | /* mute/unmute internal speaker */ |
| 9482 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9483 | HDA_AMP_MUTE, mute); |
| 9484 | /* mute/unmute HP */ |
| 9485 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9486 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9487 | } |
| 9488 | |
| 9489 | /* unsolicited event for HP jack sensing */ |
| 9490 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9491 | unsigned int res) |
| 9492 | { |
| 9493 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9494 | return; |
| 9495 | alc262_ultra_automute(codec); |
| 9496 | } |
| 9497 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9498 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9499 | .num_items = 2, |
| 9500 | .items = { |
| 9501 | { "Mic", 0x1 }, |
| 9502 | { "Headphone", 0x7 }, |
| 9503 | }, |
| 9504 | }; |
| 9505 | |
| 9506 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9507 | struct snd_ctl_elem_value *ucontrol) |
| 9508 | { |
| 9509 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9510 | struct alc_spec *spec = codec->spec; |
| 9511 | int ret; |
| 9512 | |
| 9513 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 9514 | if (!ret) |
| 9515 | return 0; |
| 9516 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9517 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9518 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9519 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9520 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9521 | return ret; |
| 9522 | } |
| 9523 | |
| 9524 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9525 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9526 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9527 | { |
| 9528 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9529 | .name = "Capture Source", |
| 9530 | .info = alc882_mux_enum_info, |
| 9531 | .get = alc882_mux_enum_get, |
| 9532 | .put = alc262_ultra_mux_enum_put, |
| 9533 | }, |
| 9534 | { } /* end */ |
| 9535 | }; |
| 9536 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9537 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9538 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9539 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9540 | { |
| 9541 | hda_nid_t nid; |
| 9542 | int err; |
| 9543 | |
| 9544 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9545 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9546 | spec->multiout.dac_nids[0] = 2; |
| 9547 | |
| 9548 | nid = cfg->line_out_pins[0]; |
| 9549 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9550 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9551 | "Front Playback Volume", |
| 9552 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9553 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9554 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9555 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9556 | "Front Playback Switch", |
| 9557 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9558 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9559 | return err; |
| 9560 | } |
| 9561 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9562 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9563 | if (nid) { |
| 9564 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9565 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9566 | "Speaker Playback Volume", |
| 9567 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9568 | HDA_OUTPUT)); |
| 9569 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9570 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9571 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9572 | "Speaker Playback Switch", |
| 9573 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9574 | HDA_OUTPUT)); |
| 9575 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9576 | return err; |
| 9577 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9578 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9579 | "Speaker Playback Switch", |
| 9580 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9581 | HDA_OUTPUT)); |
| 9582 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9583 | return err; |
| 9584 | } |
| 9585 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9586 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9587 | if (nid) { |
| 9588 | /* spec->multiout.hp_nid = 2; */ |
| 9589 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9590 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9591 | "Headphone Playback Volume", |
| 9592 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9593 | HDA_OUTPUT)); |
| 9594 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9595 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9596 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9597 | "Headphone Playback Switch", |
| 9598 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9599 | HDA_OUTPUT)); |
| 9600 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9601 | return err; |
| 9602 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9603 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9604 | "Headphone Playback Switch", |
| 9605 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9606 | HDA_OUTPUT)); |
| 9607 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9608 | return err; |
| 9609 | } |
| 9610 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9611 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9612 | } |
| 9613 | |
| 9614 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9615 | #define alc262_auto_create_analog_input_ctls \ |
| 9616 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9617 | |
| 9618 | /* |
| 9619 | * generic initialization of ADC, input mixers and output mixers |
| 9620 | */ |
| 9621 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9622 | /* |
| 9623 | * Unmute ADC0-2 and set the default input to mic-in |
| 9624 | */ |
| 9625 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9626 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9627 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9628 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9629 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9630 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9631 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9632 | /* 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] | 9633 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9634 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9635 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9636 | */ |
| 9637 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9638 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9639 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9641 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9642 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9643 | |
| 9644 | /* |
| 9645 | * Set up output mixers (0x0c - 0x0f) |
| 9646 | */ |
| 9647 | /* set vol=0 to output mixers */ |
| 9648 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9649 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9650 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9651 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9652 | /* set up input amps for analog loopback */ |
| 9653 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9654 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9655 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9656 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9657 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9658 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9659 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9660 | |
| 9661 | /* FIXME: use matrix-type input source selection */ |
| 9662 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9663 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9664 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9665 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9666 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9667 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9668 | /* Input mixer2 */ |
| 9669 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9670 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9671 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9672 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9673 | /* Input mixer3 */ |
| 9674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9675 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9676 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9677 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9678 | |
| 9679 | { } |
| 9680 | }; |
| 9681 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9682 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9683 | /* |
| 9684 | * Unmute ADC0-2 and set the default input to mic-in |
| 9685 | */ |
| 9686 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9687 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9688 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9689 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9690 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9691 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9692 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9693 | /* 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] | 9694 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9695 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9696 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9697 | */ |
| 9698 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9699 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9700 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9701 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9702 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9703 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9704 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9705 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9706 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9707 | /* |
| 9708 | * Set up output mixers (0x0c - 0x0e) |
| 9709 | */ |
| 9710 | /* set vol=0 to output mixers */ |
| 9711 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9712 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9713 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9714 | |
| 9715 | /* set up input amps for analog loopback */ |
| 9716 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9717 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9718 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9719 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9720 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9721 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9722 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9723 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9724 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9725 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9726 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9727 | |
| 9728 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9729 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9730 | |
| 9731 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9732 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9733 | |
| 9734 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9735 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9736 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9737 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9738 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9739 | |
| 9740 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9741 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9742 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9743 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9744 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9745 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9746 | |
| 9747 | |
| 9748 | /* FIXME: use matrix-type input source selection */ |
| 9749 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9750 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9751 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9752 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9753 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9754 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9755 | /* Input mixer2 */ |
| 9756 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9757 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9758 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9759 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9760 | /* Input mixer3 */ |
| 9761 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9762 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9763 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9764 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9765 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9766 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9767 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9768 | { } |
| 9769 | }; |
| 9770 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9771 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9772 | /* |
| 9773 | * Unmute ADC0-2 and set the default input to mic-in |
| 9774 | */ |
| 9775 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9776 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9777 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9778 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9779 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9780 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9781 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9782 | /* 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] | 9783 | * mixer widget |
| 9784 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9785 | * panel mic (mic 2) |
| 9786 | */ |
| 9787 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9788 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9789 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9790 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9791 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9792 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9793 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9794 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9795 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9796 | /* |
| 9797 | * Set up output mixers (0x0c - 0x0e) |
| 9798 | */ |
| 9799 | /* set vol=0 to output mixers */ |
| 9800 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9801 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9802 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9803 | |
| 9804 | /* set up input amps for analog loopback */ |
| 9805 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9806 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9807 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9808 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9809 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9810 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9811 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9812 | |
| 9813 | |
| 9814 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9815 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9816 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9817 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9818 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9819 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9820 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9821 | |
| 9822 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9823 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9824 | |
| 9825 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9826 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9827 | |
| 9828 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9829 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9830 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9831 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9832 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9833 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9834 | |
| 9835 | /* FIXME: use matrix-type input source selection */ |
| 9836 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9837 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9838 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9839 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9840 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9841 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9842 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9843 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9844 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9845 | /* Input mixer2 */ |
| 9846 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9847 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9848 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9849 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9850 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9851 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9852 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9853 | /* Input mixer3 */ |
| 9854 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9855 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9856 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9857 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9858 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9859 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9860 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9861 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9862 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9863 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9864 | { } |
| 9865 | }; |
| 9866 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9867 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9868 | #define alc262_loopbacks alc880_loopbacks |
| 9869 | #endif |
| 9870 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9871 | /* pcm configuration: identiacal with ALC880 */ |
| 9872 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9873 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9874 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9875 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9876 | |
| 9877 | /* |
| 9878 | * BIOS auto configuration |
| 9879 | */ |
| 9880 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9881 | { |
| 9882 | struct alc_spec *spec = codec->spec; |
| 9883 | int err; |
| 9884 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9885 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9886 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9887 | alc262_ignore); |
| 9888 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9889 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9890 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9891 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9892 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9893 | if (err < 0) |
| 9894 | return err; |
| 9895 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9896 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9897 | return err; |
| 9898 | |
| 9899 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9900 | |
| 9901 | if (spec->autocfg.dig_out_pin) |
| 9902 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9903 | if (spec->autocfg.dig_in_pin) |
| 9904 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9905 | |
| 9906 | if (spec->kctl_alloc) |
| 9907 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9908 | |
| 9909 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9910 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9911 | spec->input_mux = &spec->private_imux; |
| 9912 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9913 | err = alc_auto_add_mic_boost(codec); |
| 9914 | if (err < 0) |
| 9915 | return err; |
| 9916 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9917 | return 1; |
| 9918 | } |
| 9919 | |
| 9920 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9921 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9922 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9923 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9924 | |
| 9925 | |
| 9926 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9927 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9928 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9929 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9930 | alc262_auto_init_multi_out(codec); |
| 9931 | alc262_auto_init_hp_out(codec); |
| 9932 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9933 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9934 | if (spec->unsol_event) |
| 9935 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9936 | } |
| 9937 | |
| 9938 | /* |
| 9939 | * configuration and preset |
| 9940 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9941 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9942 | [ALC262_BASIC] = "basic", |
| 9943 | [ALC262_HIPPO] = "hippo", |
| 9944 | [ALC262_HIPPO_1] = "hippo_1", |
| 9945 | [ALC262_FUJITSU] = "fujitsu", |
| 9946 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9947 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9948 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9949 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9950 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9951 | [ALC262_BENQ_T31] = "benq-t31", |
| 9952 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9953 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9954 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9955 | [ALC262_NEC] = "nec", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9956 | [ALC262_AUTO] = "auto", |
| 9957 | }; |
| 9958 | |
| 9959 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9960 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9961 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9962 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9963 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9964 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9965 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9966 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9967 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9968 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9969 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9970 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9971 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9972 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9973 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9974 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9975 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9976 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9977 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9978 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9979 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9980 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9981 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9982 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9983 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9984 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9985 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9986 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9987 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9988 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 9989 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
| 9990 | ALC262_SONY_ASSAMD), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame^] | 9991 | SND_PCI_QUIRK(0x1179, 0x0268, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9992 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9993 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9994 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9995 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9996 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9997 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9998 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9999 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10000 | {} |
| 10001 | }; |
| 10002 | |
| 10003 | static struct alc_config_preset alc262_presets[] = { |
| 10004 | [ALC262_BASIC] = { |
| 10005 | .mixers = { alc262_base_mixer }, |
| 10006 | .init_verbs = { alc262_init_verbs }, |
| 10007 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10008 | .dac_nids = alc262_dac_nids, |
| 10009 | .hp_nid = 0x03, |
| 10010 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10011 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10012 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10013 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10014 | [ALC262_HIPPO] = { |
| 10015 | .mixers = { alc262_base_mixer }, |
| 10016 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10017 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10018 | .dac_nids = alc262_dac_nids, |
| 10019 | .hp_nid = 0x03, |
| 10020 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10021 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10022 | .channel_mode = alc262_modes, |
| 10023 | .input_mux = &alc262_capture_source, |
| 10024 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10025 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10026 | }, |
| 10027 | [ALC262_HIPPO_1] = { |
| 10028 | .mixers = { alc262_hippo1_mixer }, |
| 10029 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10030 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10031 | .dac_nids = alc262_dac_nids, |
| 10032 | .hp_nid = 0x02, |
| 10033 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10034 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10035 | .channel_mode = alc262_modes, |
| 10036 | .input_mux = &alc262_capture_source, |
| 10037 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10038 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10039 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10040 | [ALC262_FUJITSU] = { |
| 10041 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10042 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10043 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10044 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10045 | .dac_nids = alc262_dac_nids, |
| 10046 | .hp_nid = 0x03, |
| 10047 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10048 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10049 | .channel_mode = alc262_modes, |
| 10050 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10051 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10052 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10053 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10054 | [ALC262_HP_BPC] = { |
| 10055 | .mixers = { alc262_HP_BPC_mixer }, |
| 10056 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10057 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10058 | .dac_nids = alc262_dac_nids, |
| 10059 | .hp_nid = 0x03, |
| 10060 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10061 | .channel_mode = alc262_modes, |
| 10062 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10063 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10064 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10065 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10066 | [ALC262_HP_BPC_D7000_WF] = { |
| 10067 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10068 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10069 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10070 | .dac_nids = alc262_dac_nids, |
| 10071 | .hp_nid = 0x03, |
| 10072 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10073 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10074 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10075 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10076 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10077 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10078 | [ALC262_HP_BPC_D7000_WL] = { |
| 10079 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10080 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10081 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10082 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10083 | .dac_nids = alc262_dac_nids, |
| 10084 | .hp_nid = 0x03, |
| 10085 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10086 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10087 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10088 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10089 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10090 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10091 | [ALC262_HP_TC_T5735] = { |
| 10092 | .mixers = { alc262_hp_t5735_mixer }, |
| 10093 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10094 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10095 | .dac_nids = alc262_dac_nids, |
| 10096 | .hp_nid = 0x03, |
| 10097 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10098 | .channel_mode = alc262_modes, |
| 10099 | .input_mux = &alc262_capture_source, |
| 10100 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10101 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10102 | }, |
| 10103 | [ALC262_HP_RP5700] = { |
| 10104 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10105 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10106 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10107 | .dac_nids = alc262_dac_nids, |
| 10108 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10109 | .channel_mode = alc262_modes, |
| 10110 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10111 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10112 | [ALC262_BENQ_ED8] = { |
| 10113 | .mixers = { alc262_base_mixer }, |
| 10114 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10115 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10116 | .dac_nids = alc262_dac_nids, |
| 10117 | .hp_nid = 0x03, |
| 10118 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10119 | .channel_mode = alc262_modes, |
| 10120 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10121 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10122 | [ALC262_SONY_ASSAMD] = { |
| 10123 | .mixers = { alc262_sony_mixer }, |
| 10124 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10125 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10126 | .dac_nids = alc262_dac_nids, |
| 10127 | .hp_nid = 0x02, |
| 10128 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10129 | .channel_mode = alc262_modes, |
| 10130 | .input_mux = &alc262_capture_source, |
| 10131 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10132 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10133 | }, |
| 10134 | [ALC262_BENQ_T31] = { |
| 10135 | .mixers = { alc262_benq_t31_mixer }, |
| 10136 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10137 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10138 | .dac_nids = alc262_dac_nids, |
| 10139 | .hp_nid = 0x03, |
| 10140 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10141 | .channel_mode = alc262_modes, |
| 10142 | .input_mux = &alc262_capture_source, |
| 10143 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10144 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10145 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10146 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10147 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 10148 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10149 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10150 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10151 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10152 | .channel_mode = alc262_modes, |
| 10153 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10154 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10155 | .capsrc_nids = alc262_capsrc_nids, |
| 10156 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10157 | .unsol_event = alc262_ultra_unsol_event, |
| 10158 | .init_hook = alc262_ultra_automute, |
| 10159 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10160 | [ALC262_LENOVO_3000] = { |
| 10161 | .mixers = { alc262_lenovo_3000_mixer }, |
| 10162 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10163 | alc262_lenovo_3000_unsol_verbs }, |
| 10164 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10165 | .dac_nids = alc262_dac_nids, |
| 10166 | .hp_nid = 0x03, |
| 10167 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10168 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10169 | .channel_mode = alc262_modes, |
| 10170 | .input_mux = &alc262_fujitsu_capture_source, |
| 10171 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 10172 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10173 | [ALC262_NEC] = { |
| 10174 | .mixers = { alc262_nec_mixer }, |
| 10175 | .init_verbs = { alc262_nec_verbs }, |
| 10176 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10177 | .dac_nids = alc262_dac_nids, |
| 10178 | .hp_nid = 0x03, |
| 10179 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10180 | .channel_mode = alc262_modes, |
| 10181 | .input_mux = &alc262_capture_source, |
| 10182 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame^] | 10183 | [ALC262_TOSHIBA_S06] = { |
| 10184 | .mixers = { alc262_toshiba_s06_mixer }, |
| 10185 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 10186 | alc262_eapd_verbs }, |
| 10187 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10188 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 10189 | .dac_nids = alc262_dac_nids, |
| 10190 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 10191 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10192 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10193 | .channel_mode = alc262_modes, |
| 10194 | .input_mux = &alc262_dmic_capture_source, |
| 10195 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 10196 | .init_hook = alc262_toshiba_s06_init_hook, |
| 10197 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10198 | }; |
| 10199 | |
| 10200 | static int patch_alc262(struct hda_codec *codec) |
| 10201 | { |
| 10202 | struct alc_spec *spec; |
| 10203 | int board_config; |
| 10204 | int err; |
| 10205 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 10206 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10207 | if (spec == NULL) |
| 10208 | return -ENOMEM; |
| 10209 | |
| 10210 | codec->spec = spec; |
| 10211 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10212 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 10213 | * under-run |
| 10214 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10215 | { |
| 10216 | int tmp; |
| 10217 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10218 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 10219 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10220 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 10221 | } |
| 10222 | #endif |
| 10223 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 10224 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10225 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10226 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 10227 | alc262_models, |
| 10228 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10229 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10230 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10231 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 10232 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10233 | board_config = ALC262_AUTO; |
| 10234 | } |
| 10235 | |
| 10236 | if (board_config == ALC262_AUTO) { |
| 10237 | /* automatic parse from the BIOS config */ |
| 10238 | err = alc262_parse_auto_config(codec); |
| 10239 | if (err < 0) { |
| 10240 | alc_free(codec); |
| 10241 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10242 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10243 | printk(KERN_INFO |
| 10244 | "hda_codec: Cannot set up configuration " |
| 10245 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10246 | board_config = ALC262_BASIC; |
| 10247 | } |
| 10248 | } |
| 10249 | |
| 10250 | if (board_config != ALC262_AUTO) |
| 10251 | setup_preset(spec, &alc262_presets[board_config]); |
| 10252 | |
| 10253 | spec->stream_name_analog = "ALC262 Analog"; |
| 10254 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 10255 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10256 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10257 | spec->stream_name_digital = "ALC262 Digital"; |
| 10258 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 10259 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 10260 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10261 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10262 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 10263 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 10264 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10265 | /* get type */ |
| 10266 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10267 | if (wcap != AC_WID_AUD_IN) { |
| 10268 | spec->adc_nids = alc262_adc_nids_alt; |
| 10269 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10270 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10271 | spec->mixers[spec->num_mixers] = |
| 10272 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10273 | spec->num_mixers++; |
| 10274 | } else { |
| 10275 | spec->adc_nids = alc262_adc_nids; |
| 10276 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10277 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10278 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 10279 | spec->num_mixers++; |
| 10280 | } |
| 10281 | } |
| 10282 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10283 | spec->vmaster_nid = 0x0c; |
| 10284 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10285 | codec->patch_ops = alc_patch_ops; |
| 10286 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10287 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10288 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10289 | if (!spec->loopback.amplist) |
| 10290 | spec->loopback.amplist = alc262_loopbacks; |
| 10291 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10292 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10293 | return 0; |
| 10294 | } |
| 10295 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10296 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10297 | * ALC268 channel source setting (2 channel) |
| 10298 | */ |
| 10299 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 10300 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10301 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10302 | static hda_nid_t alc268_dac_nids[2] = { |
| 10303 | /* front, hp */ |
| 10304 | 0x02, 0x03 |
| 10305 | }; |
| 10306 | |
| 10307 | static hda_nid_t alc268_adc_nids[2] = { |
| 10308 | /* ADC0-1 */ |
| 10309 | 0x08, 0x07 |
| 10310 | }; |
| 10311 | |
| 10312 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 10313 | /* ADC0 */ |
| 10314 | 0x08 |
| 10315 | }; |
| 10316 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10317 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 10318 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10319 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 10320 | /* output mixer control */ |
| 10321 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10322 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10323 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10324 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10325 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10326 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10327 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10328 | { } |
| 10329 | }; |
| 10330 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10331 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 10332 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 10333 | .ops = &snd_hda_bind_sw, |
| 10334 | .values = { |
| 10335 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 10336 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 10337 | 0 |
| 10338 | }, |
| 10339 | }; |
| 10340 | |
| 10341 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 10342 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 10343 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 10344 | { } |
| 10345 | }; |
| 10346 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10347 | static struct hda_verb alc268_eapd_verbs[] = { |
| 10348 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10349 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10350 | { } |
| 10351 | }; |
| 10352 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10353 | /* Toshiba specific */ |
| 10354 | #define alc268_toshiba_automute alc262_hippo_automute |
| 10355 | |
| 10356 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 10357 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10358 | { } /* end */ |
| 10359 | }; |
| 10360 | |
| 10361 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10362 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 10363 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 10364 | .ops = &snd_hda_bind_vol, |
| 10365 | .values = { |
| 10366 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 10367 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 10368 | 0 |
| 10369 | }, |
| 10370 | }; |
| 10371 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10372 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10373 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 10374 | { |
| 10375 | struct alc_spec *spec = codec->spec; |
| 10376 | unsigned int mute; |
| 10377 | |
| 10378 | if (force || !spec->sense_updated) { |
| 10379 | unsigned int present; |
| 10380 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10381 | AC_VERB_GET_PIN_SENSE, 0); |
| 10382 | spec->jack_present = (present & 0x80000000) != 0; |
| 10383 | spec->sense_updated = 1; |
| 10384 | } |
| 10385 | if (spec->jack_present) |
| 10386 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 10387 | else /* unmute internal speaker if necessary */ |
| 10388 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 10389 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10390 | HDA_AMP_MUTE, mute); |
| 10391 | } |
| 10392 | |
| 10393 | |
| 10394 | /* bind hp and internal speaker mute (with plug check) */ |
| 10395 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10396 | struct snd_ctl_elem_value *ucontrol) |
| 10397 | { |
| 10398 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10399 | long *valp = ucontrol->value.integer.value; |
| 10400 | int change; |
| 10401 | |
| 10402 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10403 | HDA_AMP_MUTE, |
| 10404 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 10405 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10406 | HDA_AMP_MUTE, |
| 10407 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 10408 | if (change) |
| 10409 | alc268_acer_automute(codec, 0); |
| 10410 | return change; |
| 10411 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10412 | |
| 10413 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 10414 | /* output mixer control */ |
| 10415 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10416 | { |
| 10417 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10418 | .name = "Master Playback Switch", |
| 10419 | .info = snd_hda_mixer_amp_switch_info, |
| 10420 | .get = snd_hda_mixer_amp_switch_get, |
| 10421 | .put = alc268_acer_master_sw_put, |
| 10422 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10423 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10424 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10425 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10426 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10427 | { } |
| 10428 | }; |
| 10429 | |
| 10430 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10431 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 10432 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10433 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10434 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10435 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10436 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10437 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10438 | { } |
| 10439 | }; |
| 10440 | |
| 10441 | /* unsolicited event for HP jack sensing */ |
| 10442 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 10443 | unsigned int res) |
| 10444 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10445 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10446 | return; |
| 10447 | alc268_toshiba_automute(codec); |
| 10448 | } |
| 10449 | |
| 10450 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 10451 | unsigned int res) |
| 10452 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10453 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10454 | return; |
| 10455 | alc268_acer_automute(codec, 1); |
| 10456 | } |
| 10457 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10458 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 10459 | { |
| 10460 | alc268_acer_automute(codec, 1); |
| 10461 | } |
| 10462 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10463 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 10464 | /* output mixer control */ |
| 10465 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10466 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10467 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10468 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10469 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10470 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10471 | { } |
| 10472 | }; |
| 10473 | |
| 10474 | static struct hda_verb alc268_dell_verbs[] = { |
| 10475 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10476 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10477 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10478 | { } |
| 10479 | }; |
| 10480 | |
| 10481 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10482 | static void alc268_dell_automute(struct hda_codec *codec) |
| 10483 | { |
| 10484 | unsigned int present; |
| 10485 | unsigned int mute; |
| 10486 | |
| 10487 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 10488 | if (present & 0x80000000) |
| 10489 | mute = HDA_AMP_MUTE; |
| 10490 | else |
| 10491 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 10492 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10493 | HDA_AMP_MUTE, mute); |
| 10494 | } |
| 10495 | |
| 10496 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 10497 | unsigned int res) |
| 10498 | { |
| 10499 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10500 | return; |
| 10501 | alc268_dell_automute(codec); |
| 10502 | } |
| 10503 | |
| 10504 | #define alc268_dell_init_hook alc268_dell_automute |
| 10505 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10506 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 10507 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10508 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10509 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10510 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10511 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10512 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10513 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 10514 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10515 | { } |
| 10516 | }; |
| 10517 | |
| 10518 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 10519 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10520 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 10521 | { } |
| 10522 | }; |
| 10523 | |
| 10524 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 10525 | { |
| 10526 | unsigned int present; |
| 10527 | |
| 10528 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 10529 | & AC_PINSENSE_PRESENCE; |
| 10530 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10531 | present ? 0 : PIN_OUT); |
| 10532 | } |
| 10533 | |
| 10534 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 10535 | { |
| 10536 | unsigned int present; |
| 10537 | |
| 10538 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10539 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10540 | snd_hda_codec_write(codec, 0x23, 0, |
| 10541 | AC_VERB_SET_CONNECT_SEL, |
| 10542 | present ? 0x00 : 0x01); |
| 10543 | } |
| 10544 | |
| 10545 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 10546 | { |
| 10547 | alc267_quanta_il1_hp_automute(codec); |
| 10548 | alc267_quanta_il1_mic_automute(codec); |
| 10549 | } |
| 10550 | |
| 10551 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 10552 | unsigned int res) |
| 10553 | { |
| 10554 | switch (res >> 26) { |
| 10555 | case ALC880_HP_EVENT: |
| 10556 | alc267_quanta_il1_hp_automute(codec); |
| 10557 | break; |
| 10558 | case ALC880_MIC_EVENT: |
| 10559 | alc267_quanta_il1_mic_automute(codec); |
| 10560 | break; |
| 10561 | } |
| 10562 | } |
| 10563 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10564 | /* |
| 10565 | * generic initialization of ADC, input mixers and output mixers |
| 10566 | */ |
| 10567 | static struct hda_verb alc268_base_init_verbs[] = { |
| 10568 | /* Unmute DAC0-1 and set vol = 0 */ |
| 10569 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10570 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10571 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10572 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10573 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10574 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10575 | |
| 10576 | /* |
| 10577 | * Set up output mixers (0x0c - 0x0e) |
| 10578 | */ |
| 10579 | /* set vol=0 to output mixers */ |
| 10580 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10581 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10582 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10583 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10584 | |
| 10585 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10586 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10587 | |
| 10588 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10589 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10590 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10591 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10592 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10593 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10594 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10595 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10596 | |
| 10597 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10598 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10599 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10600 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10601 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10602 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10603 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10604 | |
| 10605 | /* set PCBEEP vol = 0, mute connections */ |
| 10606 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10607 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10608 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10609 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10610 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10611 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10612 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10613 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10614 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10615 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10616 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10617 | { } |
| 10618 | }; |
| 10619 | |
| 10620 | /* |
| 10621 | * generic initialization of ADC, input mixers and output mixers |
| 10622 | */ |
| 10623 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 10624 | /* set output DAC */ |
| 10625 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10626 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10627 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10628 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10629 | |
| 10630 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10631 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10632 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10633 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10634 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10635 | |
| 10636 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10637 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10638 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10639 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10640 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10641 | |
| 10642 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10643 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10644 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10645 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10646 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10647 | /* set PCBEEP vol = 0, mute connections */ |
| 10648 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10649 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10650 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10651 | |
| 10652 | { } |
| 10653 | }; |
| 10654 | |
| 10655 | #define alc268_mux_enum_info alc_mux_enum_info |
| 10656 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10657 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10658 | |
| 10659 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 10660 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10661 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10662 | { |
| 10663 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10664 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10665 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10666 | */ |
| 10667 | /* .name = "Capture Source", */ |
| 10668 | .name = "Input Source", |
| 10669 | .count = 1, |
| 10670 | .info = alc268_mux_enum_info, |
| 10671 | .get = alc268_mux_enum_get, |
| 10672 | .put = alc268_mux_enum_put, |
| 10673 | }, |
| 10674 | { } /* end */ |
| 10675 | }; |
| 10676 | |
| 10677 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 10678 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10679 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10680 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10681 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10682 | { |
| 10683 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10684 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10685 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10686 | */ |
| 10687 | /* .name = "Capture Source", */ |
| 10688 | .name = "Input Source", |
| 10689 | .count = 2, |
| 10690 | .info = alc268_mux_enum_info, |
| 10691 | .get = alc268_mux_enum_get, |
| 10692 | .put = alc268_mux_enum_put, |
| 10693 | }, |
| 10694 | { } /* end */ |
| 10695 | }; |
| 10696 | |
| 10697 | static struct hda_input_mux alc268_capture_source = { |
| 10698 | .num_items = 4, |
| 10699 | .items = { |
| 10700 | { "Mic", 0x0 }, |
| 10701 | { "Front Mic", 0x1 }, |
| 10702 | { "Line", 0x2 }, |
| 10703 | { "CD", 0x3 }, |
| 10704 | }, |
| 10705 | }; |
| 10706 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10707 | static struct hda_input_mux alc268_acer_capture_source = { |
| 10708 | .num_items = 3, |
| 10709 | .items = { |
| 10710 | { "Mic", 0x0 }, |
| 10711 | { "Internal Mic", 0x6 }, |
| 10712 | { "Line", 0x2 }, |
| 10713 | }, |
| 10714 | }; |
| 10715 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10716 | #ifdef CONFIG_SND_DEBUG |
| 10717 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10718 | /* Volume widgets */ |
| 10719 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10720 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10721 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10722 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10723 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 10724 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 10725 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 10726 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 10727 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 10728 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 10729 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 10730 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 10731 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 10732 | /* The below appears problematic on some hardwares */ |
| 10733 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10734 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10735 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10736 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 10737 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 10738 | |
| 10739 | /* Modes for retasking pin widgets */ |
| 10740 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 10741 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 10742 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 10743 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 10744 | |
| 10745 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 10746 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 10747 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 10748 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 10749 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 10750 | |
| 10751 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 10752 | * The ALC268 does not have an SPDIF input. |
| 10753 | */ |
| 10754 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 10755 | |
| 10756 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 10757 | * this output to turn on an external amplifier. |
| 10758 | */ |
| 10759 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 10760 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 10761 | |
| 10762 | { } /* end */ |
| 10763 | }; |
| 10764 | #endif |
| 10765 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10766 | /* create input playback/capture controls for the given pin */ |
| 10767 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 10768 | const char *ctlname, int idx) |
| 10769 | { |
| 10770 | char name[32]; |
| 10771 | int err; |
| 10772 | |
| 10773 | sprintf(name, "%s Playback Volume", ctlname); |
| 10774 | if (nid == 0x14) { |
| 10775 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10776 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 10777 | HDA_OUTPUT)); |
| 10778 | if (err < 0) |
| 10779 | return err; |
| 10780 | } else if (nid == 0x15) { |
| 10781 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10782 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 10783 | HDA_OUTPUT)); |
| 10784 | if (err < 0) |
| 10785 | return err; |
| 10786 | } else |
| 10787 | return -1; |
| 10788 | sprintf(name, "%s Playback Switch", ctlname); |
| 10789 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10790 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 10791 | if (err < 0) |
| 10792 | return err; |
| 10793 | return 0; |
| 10794 | } |
| 10795 | |
| 10796 | /* add playback controls from the parsed DAC table */ |
| 10797 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10798 | const struct auto_pin_cfg *cfg) |
| 10799 | { |
| 10800 | hda_nid_t nid; |
| 10801 | int err; |
| 10802 | |
| 10803 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 10804 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10805 | spec->multiout.dac_nids[0] = 2; |
| 10806 | spec->multiout.dac_nids[1] = 3; |
| 10807 | |
| 10808 | nid = cfg->line_out_pins[0]; |
| 10809 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10810 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10811 | |
| 10812 | nid = cfg->speaker_pins[0]; |
| 10813 | if (nid == 0x1d) { |
| 10814 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10815 | "Speaker Playback Volume", |
| 10816 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10817 | if (err < 0) |
| 10818 | return err; |
| 10819 | } |
| 10820 | nid = cfg->hp_pins[0]; |
| 10821 | if (nid) |
| 10822 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 10823 | |
| 10824 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 10825 | if (nid == 0x16) { |
| 10826 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10827 | "Mono Playback Switch", |
| 10828 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 10829 | if (err < 0) |
| 10830 | return err; |
| 10831 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10832 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10833 | } |
| 10834 | |
| 10835 | /* create playback/capture controls for input pins */ |
| 10836 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10837 | const struct auto_pin_cfg *cfg) |
| 10838 | { |
| 10839 | struct hda_input_mux *imux = &spec->private_imux; |
| 10840 | int i, idx1; |
| 10841 | |
| 10842 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10843 | switch(cfg->input_pins[i]) { |
| 10844 | case 0x18: |
| 10845 | idx1 = 0; /* Mic 1 */ |
| 10846 | break; |
| 10847 | case 0x19: |
| 10848 | idx1 = 1; /* Mic 2 */ |
| 10849 | break; |
| 10850 | case 0x1a: |
| 10851 | idx1 = 2; /* Line In */ |
| 10852 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10853 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10854 | idx1 = 3; /* CD */ |
| 10855 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 10856 | case 0x12: |
| 10857 | case 0x13: |
| 10858 | idx1 = 6; /* digital mics */ |
| 10859 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10860 | default: |
| 10861 | continue; |
| 10862 | } |
| 10863 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 10864 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10865 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10866 | } |
| 10867 | return 0; |
| 10868 | } |
| 10869 | |
| 10870 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 10871 | { |
| 10872 | struct alc_spec *spec = codec->spec; |
| 10873 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10874 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10875 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10876 | unsigned int dac_vol1, dac_vol2; |
| 10877 | |
| 10878 | if (speaker_nid) { |
| 10879 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 10880 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 10881 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10882 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10883 | AMP_IN_UNMUTE(1)); |
| 10884 | snd_hda_codec_write(codec, 0x10, 0, |
| 10885 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10886 | AMP_IN_UNMUTE(1)); |
| 10887 | } else { |
| 10888 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10889 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10890 | snd_hda_codec_write(codec, 0x10, 0, |
| 10891 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10892 | } |
| 10893 | |
| 10894 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10895 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10896 | dac_vol2 = AMP_OUT_ZERO; |
| 10897 | else if (line_nid == 0x15) |
| 10898 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10899 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10900 | dac_vol2 = AMP_OUT_ZERO; |
| 10901 | else if (hp_nid == 0x15) |
| 10902 | dac_vol1 = AMP_OUT_ZERO; |
| 10903 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10904 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10905 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10906 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10907 | |
| 10908 | snd_hda_codec_write(codec, 0x02, 0, |
| 10909 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10910 | snd_hda_codec_write(codec, 0x03, 0, |
| 10911 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10912 | } |
| 10913 | |
| 10914 | /* pcm configuration: identiacal with ALC880 */ |
| 10915 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10916 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10917 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10918 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10919 | |
| 10920 | /* |
| 10921 | * BIOS auto configuration |
| 10922 | */ |
| 10923 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10924 | { |
| 10925 | struct alc_spec *spec = codec->spec; |
| 10926 | int err; |
| 10927 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10928 | |
| 10929 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10930 | alc268_ignore); |
| 10931 | if (err < 0) |
| 10932 | return err; |
| 10933 | if (!spec->autocfg.line_outs) |
| 10934 | return 0; /* can't find valid BIOS pin config */ |
| 10935 | |
| 10936 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10937 | if (err < 0) |
| 10938 | return err; |
| 10939 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10940 | if (err < 0) |
| 10941 | return err; |
| 10942 | |
| 10943 | spec->multiout.max_channels = 2; |
| 10944 | |
| 10945 | /* digital only support output */ |
| 10946 | if (spec->autocfg.dig_out_pin) |
| 10947 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10948 | |
| 10949 | if (spec->kctl_alloc) |
| 10950 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10951 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10952 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 10953 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 10954 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10955 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10956 | spec->num_mux_defs = 1; |
| 10957 | spec->input_mux = &spec->private_imux; |
| 10958 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10959 | err = alc_auto_add_mic_boost(codec); |
| 10960 | if (err < 0) |
| 10961 | return err; |
| 10962 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10963 | return 1; |
| 10964 | } |
| 10965 | |
| 10966 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10967 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10968 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10969 | |
| 10970 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10971 | static void alc268_auto_init(struct hda_codec *codec) |
| 10972 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10973 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10974 | alc268_auto_init_multi_out(codec); |
| 10975 | alc268_auto_init_hp_out(codec); |
| 10976 | alc268_auto_init_mono_speaker_out(codec); |
| 10977 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10978 | if (spec->unsol_event) |
| 10979 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10980 | } |
| 10981 | |
| 10982 | /* |
| 10983 | * configuration and preset |
| 10984 | */ |
| 10985 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10986 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10987 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10988 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10989 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10990 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10991 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10992 | #ifdef CONFIG_SND_DEBUG |
| 10993 | [ALC268_TEST] = "test", |
| 10994 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10995 | [ALC268_AUTO] = "auto", |
| 10996 | }; |
| 10997 | |
| 10998 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 10999 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11000 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11001 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11002 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11003 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11004 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11005 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11006 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11007 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11008 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11009 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11010 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11011 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11012 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11013 | {} |
| 11014 | }; |
| 11015 | |
| 11016 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11017 | [ALC267_QUANTA_IL1] = { |
| 11018 | .mixers = { alc267_quanta_il1_mixer }, |
| 11019 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11020 | alc267_quanta_il1_verbs }, |
| 11021 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11022 | .dac_nids = alc268_dac_nids, |
| 11023 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11024 | .adc_nids = alc268_adc_nids_alt, |
| 11025 | .hp_nid = 0x03, |
| 11026 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11027 | .channel_mode = alc268_modes, |
| 11028 | .input_mux = &alc268_capture_source, |
| 11029 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 11030 | .init_hook = alc267_quanta_il1_automute, |
| 11031 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11032 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11033 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11034 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11035 | .init_verbs = { alc268_base_init_verbs }, |
| 11036 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11037 | .dac_nids = alc268_dac_nids, |
| 11038 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11039 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11040 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11041 | .hp_nid = 0x03, |
| 11042 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11043 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11044 | .channel_mode = alc268_modes, |
| 11045 | .input_mux = &alc268_capture_source, |
| 11046 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11047 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11048 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11049 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11050 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11051 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11052 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11053 | .dac_nids = alc268_dac_nids, |
| 11054 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11055 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11056 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11057 | .hp_nid = 0x03, |
| 11058 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11059 | .channel_mode = alc268_modes, |
| 11060 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11061 | .unsol_event = alc268_toshiba_unsol_event, |
| 11062 | .init_hook = alc268_toshiba_automute, |
| 11063 | }, |
| 11064 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11065 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 11066 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11067 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11068 | alc268_acer_verbs }, |
| 11069 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11070 | .dac_nids = alc268_dac_nids, |
| 11071 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11072 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11073 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11074 | .hp_nid = 0x02, |
| 11075 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11076 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11077 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11078 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11079 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11080 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11081 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11082 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11083 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11084 | alc268_dell_verbs }, |
| 11085 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11086 | .dac_nids = alc268_dac_nids, |
| 11087 | .hp_nid = 0x02, |
| 11088 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11089 | .channel_mode = alc268_modes, |
| 11090 | .unsol_event = alc268_dell_unsol_event, |
| 11091 | .init_hook = alc268_dell_init_hook, |
| 11092 | .input_mux = &alc268_capture_source, |
| 11093 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11094 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11095 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11096 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11097 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11098 | alc268_toshiba_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, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11103 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11104 | .hp_nid = 0x03, |
| 11105 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11106 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11107 | .channel_mode = alc268_modes, |
| 11108 | .input_mux = &alc268_capture_source, |
| 11109 | .unsol_event = alc268_toshiba_unsol_event, |
| 11110 | .init_hook = alc268_toshiba_automute |
| 11111 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11112 | #ifdef CONFIG_SND_DEBUG |
| 11113 | [ALC268_TEST] = { |
| 11114 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 11115 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11116 | alc268_volume_init_verbs }, |
| 11117 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11118 | .dac_nids = alc268_dac_nids, |
| 11119 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11120 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11121 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11122 | .hp_nid = 0x03, |
| 11123 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11124 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11125 | .channel_mode = alc268_modes, |
| 11126 | .input_mux = &alc268_capture_source, |
| 11127 | }, |
| 11128 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11129 | }; |
| 11130 | |
| 11131 | static int patch_alc268(struct hda_codec *codec) |
| 11132 | { |
| 11133 | struct alc_spec *spec; |
| 11134 | int board_config; |
| 11135 | int err; |
| 11136 | |
| 11137 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 11138 | if (spec == NULL) |
| 11139 | return -ENOMEM; |
| 11140 | |
| 11141 | codec->spec = spec; |
| 11142 | |
| 11143 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 11144 | alc268_models, |
| 11145 | alc268_cfg_tbl); |
| 11146 | |
| 11147 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 11148 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 11149 | "trying auto-probe from BIOS...\n"); |
| 11150 | board_config = ALC268_AUTO; |
| 11151 | } |
| 11152 | |
| 11153 | if (board_config == ALC268_AUTO) { |
| 11154 | /* automatic parse from the BIOS config */ |
| 11155 | err = alc268_parse_auto_config(codec); |
| 11156 | if (err < 0) { |
| 11157 | alc_free(codec); |
| 11158 | return err; |
| 11159 | } else if (!err) { |
| 11160 | printk(KERN_INFO |
| 11161 | "hda_codec: Cannot set up configuration " |
| 11162 | "from BIOS. Using base mode...\n"); |
| 11163 | board_config = ALC268_3ST; |
| 11164 | } |
| 11165 | } |
| 11166 | |
| 11167 | if (board_config != ALC268_AUTO) |
| 11168 | setup_preset(spec, &alc268_presets[board_config]); |
| 11169 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11170 | if (codec->vendor_id == 0x10ec0267) { |
| 11171 | spec->stream_name_analog = "ALC267 Analog"; |
| 11172 | spec->stream_name_digital = "ALC267 Digital"; |
| 11173 | } else { |
| 11174 | spec->stream_name_analog = "ALC268 Analog"; |
| 11175 | spec->stream_name_digital = "ALC268 Digital"; |
| 11176 | } |
| 11177 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11178 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 11179 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11180 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11181 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11182 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 11183 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11184 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 11185 | /* override the amp caps for beep generator */ |
| 11186 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 11187 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 11188 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 11189 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 11190 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 11191 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11192 | if (!spec->adc_nids && spec->input_mux) { |
| 11193 | /* check whether NID 0x07 is valid */ |
| 11194 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11195 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11196 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11197 | /* get type */ |
| 11198 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 11199 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11200 | spec->adc_nids = alc268_adc_nids_alt; |
| 11201 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 11202 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11203 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11204 | spec->num_mixers++; |
| 11205 | } else { |
| 11206 | spec->adc_nids = alc268_adc_nids; |
| 11207 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 11208 | spec->mixers[spec->num_mixers] = |
| 11209 | alc268_capture_mixer; |
| 11210 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11211 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11212 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11213 | /* set default input source */ |
| 11214 | for (i = 0; i < spec->num_adc_nids; i++) |
| 11215 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 11216 | 0, AC_VERB_SET_CONNECT_SEL, |
| 11217 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11218 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11219 | |
| 11220 | spec->vmaster_nid = 0x02; |
| 11221 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11222 | codec->patch_ops = alc_patch_ops; |
| 11223 | if (board_config == ALC268_AUTO) |
| 11224 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11225 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11226 | return 0; |
| 11227 | } |
| 11228 | |
| 11229 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11230 | * ALC269 channel source setting (2 channel) |
| 11231 | */ |
| 11232 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 11233 | |
| 11234 | #define alc269_dac_nids alc260_dac_nids |
| 11235 | |
| 11236 | static hda_nid_t alc269_adc_nids[1] = { |
| 11237 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11238 | 0x08, |
| 11239 | }; |
| 11240 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 11241 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 11242 | 0x23, |
| 11243 | }; |
| 11244 | |
| 11245 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 11246 | * not a mux! |
| 11247 | */ |
| 11248 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11249 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 11250 | .num_items = 2, |
| 11251 | .items = { |
| 11252 | { "i-Mic", 0x5 }, |
| 11253 | { "e-Mic", 0x0 }, |
| 11254 | }, |
| 11255 | }; |
| 11256 | |
| 11257 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 11258 | .num_items = 2, |
| 11259 | .items = { |
| 11260 | { "i-Mic", 0x1 }, |
| 11261 | { "e-Mic", 0x0 }, |
| 11262 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11263 | }; |
| 11264 | |
| 11265 | #define alc269_modes alc260_modes |
| 11266 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 11267 | |
| 11268 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 11269 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11270 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11271 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11272 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11273 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11274 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11275 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11276 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11277 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11278 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11279 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11280 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11281 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11282 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 11283 | { } /* end */ |
| 11284 | }; |
| 11285 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11286 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 11287 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 11288 | .ops = &snd_hda_bind_vol, |
| 11289 | .values = { |
| 11290 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11291 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11292 | 0 |
| 11293 | }, |
| 11294 | }; |
| 11295 | |
| 11296 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 11297 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11298 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 11299 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11300 | { } /* end */ |
| 11301 | }; |
| 11302 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11303 | /* capture mixer elements */ |
| 11304 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11305 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11306 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11307 | { |
| 11308 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11309 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11310 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11311 | */ |
| 11312 | /* .name = "Capture Source", */ |
| 11313 | .name = "Input Source", |
| 11314 | .count = 1, |
| 11315 | .info = alc_mux_enum_info, |
| 11316 | .get = alc_mux_enum_get, |
| 11317 | .put = alc_mux_enum_put, |
| 11318 | }, |
| 11319 | { } /* end */ |
| 11320 | }; |
| 11321 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11322 | /* capture mixer elements */ |
| 11323 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 11324 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11325 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11326 | { } /* end */ |
| 11327 | }; |
| 11328 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11329 | /* beep control */ |
| 11330 | static struct snd_kcontrol_new alc269_beep_mixer[] = { |
| 11331 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11332 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
| 11333 | { } /* end */ |
| 11334 | }; |
| 11335 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11336 | /* |
| 11337 | * generic initialization of ADC, input mixers and output mixers |
| 11338 | */ |
| 11339 | static struct hda_verb alc269_init_verbs[] = { |
| 11340 | /* |
| 11341 | * Unmute ADC0 and set the default input to mic-in |
| 11342 | */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11343 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11344 | |
| 11345 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 11346 | * analog-loopback mixer widget |
| 11347 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11348 | * front panel mic (mic 2) |
| 11349 | */ |
| 11350 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 11351 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11352 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11353 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11354 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11355 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11356 | |
| 11357 | /* |
| 11358 | * Set up output mixers (0x0c - 0x0e) |
| 11359 | */ |
| 11360 | /* set vol=0 to output mixers */ |
| 11361 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11362 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11363 | |
| 11364 | /* set up input amps for analog loopback */ |
| 11365 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11367 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11368 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11369 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11370 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11371 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11372 | |
| 11373 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11374 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11375 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11376 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11377 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11378 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11379 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11380 | |
| 11381 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11382 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11383 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11384 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11385 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11386 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11387 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11388 | |
| 11389 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11390 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11391 | |
| 11392 | /* FIXME: use matrix-type input source selection */ |
| 11393 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 11394 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11395 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11396 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11397 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11398 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11399 | |
| 11400 | /* set EAPD */ |
| 11401 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11402 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11403 | { } |
| 11404 | }; |
| 11405 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11406 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 11407 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11408 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 11409 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11410 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 11411 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11412 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11413 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11414 | {} |
| 11415 | }; |
| 11416 | |
| 11417 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 11418 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11419 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11420 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11421 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 11422 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11423 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11424 | {} |
| 11425 | }; |
| 11426 | |
| 11427 | /* toggle speaker-output according to the hp-jack state */ |
| 11428 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 11429 | { |
| 11430 | unsigned int present; |
| 11431 | unsigned int bits; |
| 11432 | |
| 11433 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11434 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11435 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11436 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11437 | AMP_IN_MUTE(0), bits); |
| 11438 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11439 | AMP_IN_MUTE(0), bits); |
| 11440 | } |
| 11441 | |
| 11442 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 11443 | { |
| 11444 | unsigned int present; |
| 11445 | |
| 11446 | present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11447 | & AC_PINSENSE_PRESENCE; |
| 11448 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11449 | present ? 0 : 5); |
| 11450 | } |
| 11451 | |
| 11452 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 11453 | { |
| 11454 | unsigned int present; |
| 11455 | |
| 11456 | present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11457 | & AC_PINSENSE_PRESENCE; |
| 11458 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11459 | present ? AMP_IN_UNMUTE(0) : AMP_IN_MUTE(0)); |
| 11460 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11461 | present ? AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1)); |
| 11462 | } |
| 11463 | |
| 11464 | /* unsolicited event for HP jack sensing */ |
| 11465 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 11466 | unsigned int res) |
| 11467 | { |
| 11468 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11469 | alc269_speaker_automute(codec); |
| 11470 | |
| 11471 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11472 | alc269_eeepc_dmic_automute(codec); |
| 11473 | } |
| 11474 | |
| 11475 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 11476 | { |
| 11477 | alc269_speaker_automute(codec); |
| 11478 | alc269_eeepc_dmic_automute(codec); |
| 11479 | } |
| 11480 | |
| 11481 | /* unsolicited event for HP jack sensing */ |
| 11482 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11483 | unsigned int res) |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11484 | { |
| 11485 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11486 | alc269_speaker_automute(codec); |
| 11487 | |
| 11488 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11489 | alc269_eeepc_amic_automute(codec); |
| 11490 | } |
| 11491 | |
| 11492 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 11493 | { |
| 11494 | alc269_speaker_automute(codec); |
| 11495 | alc269_eeepc_amic_automute(codec); |
| 11496 | } |
| 11497 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11498 | /* add playback controls from the parsed DAC table */ |
| 11499 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11500 | const struct auto_pin_cfg *cfg) |
| 11501 | { |
| 11502 | hda_nid_t nid; |
| 11503 | int err; |
| 11504 | |
| 11505 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11506 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11507 | spec->multiout.dac_nids[0] = 2; |
| 11508 | |
| 11509 | nid = cfg->line_out_pins[0]; |
| 11510 | if (nid) { |
| 11511 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11512 | "Front Playback Volume", |
| 11513 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 11514 | if (err < 0) |
| 11515 | return err; |
| 11516 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11517 | "Front Playback Switch", |
| 11518 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11519 | if (err < 0) |
| 11520 | return err; |
| 11521 | } |
| 11522 | |
| 11523 | nid = cfg->speaker_pins[0]; |
| 11524 | if (nid) { |
| 11525 | if (!cfg->line_out_pins[0]) { |
| 11526 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11527 | "Speaker Playback Volume", |
| 11528 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 11529 | HDA_OUTPUT)); |
| 11530 | if (err < 0) |
| 11531 | return err; |
| 11532 | } |
| 11533 | if (nid == 0x16) { |
| 11534 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11535 | "Speaker Playback Switch", |
| 11536 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11537 | HDA_OUTPUT)); |
| 11538 | if (err < 0) |
| 11539 | return err; |
| 11540 | } else { |
| 11541 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11542 | "Speaker Playback Switch", |
| 11543 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11544 | HDA_OUTPUT)); |
| 11545 | if (err < 0) |
| 11546 | return err; |
| 11547 | } |
| 11548 | } |
| 11549 | nid = cfg->hp_pins[0]; |
| 11550 | if (nid) { |
| 11551 | /* spec->multiout.hp_nid = 2; */ |
| 11552 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 11553 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11554 | "Headphone Playback Volume", |
| 11555 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 11556 | HDA_OUTPUT)); |
| 11557 | if (err < 0) |
| 11558 | return err; |
| 11559 | } |
| 11560 | if (nid == 0x16) { |
| 11561 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11562 | "Headphone Playback Switch", |
| 11563 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11564 | HDA_OUTPUT)); |
| 11565 | if (err < 0) |
| 11566 | return err; |
| 11567 | } else { |
| 11568 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11569 | "Headphone Playback Switch", |
| 11570 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11571 | HDA_OUTPUT)); |
| 11572 | if (err < 0) |
| 11573 | return err; |
| 11574 | } |
| 11575 | } |
| 11576 | return 0; |
| 11577 | } |
| 11578 | |
| 11579 | #define alc269_auto_create_analog_input_ctls \ |
| 11580 | alc880_auto_create_analog_input_ctls |
| 11581 | |
| 11582 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11583 | #define alc269_loopbacks alc880_loopbacks |
| 11584 | #endif |
| 11585 | |
| 11586 | /* pcm configuration: identiacal with ALC880 */ |
| 11587 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 11588 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 11589 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 11590 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 11591 | |
| 11592 | /* |
| 11593 | * BIOS auto configuration |
| 11594 | */ |
| 11595 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 11596 | { |
| 11597 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11598 | int i, err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11599 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 11600 | |
| 11601 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11602 | alc269_ignore); |
| 11603 | if (err < 0) |
| 11604 | return err; |
| 11605 | |
| 11606 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11607 | if (err < 0) |
| 11608 | return err; |
| 11609 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11610 | if (err < 0) |
| 11611 | return err; |
| 11612 | |
| 11613 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11614 | |
| 11615 | if (spec->autocfg.dig_out_pin) |
| 11616 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 11617 | |
| 11618 | if (spec->kctl_alloc) |
| 11619 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11620 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11621 | /* create a beep mixer control if the pin 0x1d isn't assigned */ |
| 11622 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) |
| 11623 | if (spec->autocfg.input_pins[i] == 0x1d) |
| 11624 | break; |
| 11625 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) |
| 11626 | spec->mixers[spec->num_mixers++] = alc269_beep_mixer; |
| 11627 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11628 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 11629 | spec->num_mux_defs = 1; |
| 11630 | spec->input_mux = &spec->private_imux; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 11631 | /* set default input source */ |
| 11632 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 11633 | 0, AC_VERB_SET_CONNECT_SEL, |
| 11634 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11635 | |
| 11636 | err = alc_auto_add_mic_boost(codec); |
| 11637 | if (err < 0) |
| 11638 | return err; |
| 11639 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11640 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 11641 | spec->num_mixers++; |
| 11642 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11643 | return 1; |
| 11644 | } |
| 11645 | |
| 11646 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 11647 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 11648 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 11649 | |
| 11650 | |
| 11651 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11652 | static void alc269_auto_init(struct hda_codec *codec) |
| 11653 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11654 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11655 | alc269_auto_init_multi_out(codec); |
| 11656 | alc269_auto_init_hp_out(codec); |
| 11657 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11658 | if (spec->unsol_event) |
| 11659 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11660 | } |
| 11661 | |
| 11662 | /* |
| 11663 | * configuration and preset |
| 11664 | */ |
| 11665 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 11666 | [ALC269_BASIC] = "basic", |
| 11667 | }; |
| 11668 | |
| 11669 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11670 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 11671 | ALC269_ASUS_EEEPC_P703), |
| 11672 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 11673 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11674 | {} |
| 11675 | }; |
| 11676 | |
| 11677 | static struct alc_config_preset alc269_presets[] = { |
| 11678 | [ALC269_BASIC] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11679 | .mixers = { alc269_base_mixer, alc269_capture_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11680 | .init_verbs = { alc269_init_verbs }, |
| 11681 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11682 | .dac_nids = alc269_dac_nids, |
| 11683 | .hp_nid = 0x03, |
| 11684 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11685 | .channel_mode = alc269_modes, |
| 11686 | .input_mux = &alc269_capture_source, |
| 11687 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11688 | [ALC269_ASUS_EEEPC_P703] = { |
| 11689 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, |
| 11690 | .init_verbs = { alc269_init_verbs, |
| 11691 | alc269_eeepc_amic_init_verbs }, |
| 11692 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11693 | .dac_nids = alc269_dac_nids, |
| 11694 | .hp_nid = 0x03, |
| 11695 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11696 | .channel_mode = alc269_modes, |
| 11697 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 11698 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 11699 | .init_hook = alc269_eeepc_amic_inithook, |
| 11700 | }, |
| 11701 | [ALC269_ASUS_EEEPC_P901] = { |
| 11702 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer}, |
| 11703 | .init_verbs = { alc269_init_verbs, |
| 11704 | alc269_eeepc_dmic_init_verbs }, |
| 11705 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11706 | .dac_nids = alc269_dac_nids, |
| 11707 | .hp_nid = 0x03, |
| 11708 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11709 | .channel_mode = alc269_modes, |
| 11710 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 11711 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 11712 | .init_hook = alc269_eeepc_dmic_inithook, |
| 11713 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11714 | }; |
| 11715 | |
| 11716 | static int patch_alc269(struct hda_codec *codec) |
| 11717 | { |
| 11718 | struct alc_spec *spec; |
| 11719 | int board_config; |
| 11720 | int err; |
| 11721 | |
| 11722 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11723 | if (spec == NULL) |
| 11724 | return -ENOMEM; |
| 11725 | |
| 11726 | codec->spec = spec; |
| 11727 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11728 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 11729 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11730 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 11731 | alc269_models, |
| 11732 | alc269_cfg_tbl); |
| 11733 | |
| 11734 | if (board_config < 0) { |
| 11735 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 11736 | "trying auto-probe from BIOS...\n"); |
| 11737 | board_config = ALC269_AUTO; |
| 11738 | } |
| 11739 | |
| 11740 | if (board_config == ALC269_AUTO) { |
| 11741 | /* automatic parse from the BIOS config */ |
| 11742 | err = alc269_parse_auto_config(codec); |
| 11743 | if (err < 0) { |
| 11744 | alc_free(codec); |
| 11745 | return err; |
| 11746 | } else if (!err) { |
| 11747 | printk(KERN_INFO |
| 11748 | "hda_codec: Cannot set up configuration " |
| 11749 | "from BIOS. Using base mode...\n"); |
| 11750 | board_config = ALC269_BASIC; |
| 11751 | } |
| 11752 | } |
| 11753 | |
| 11754 | if (board_config != ALC269_AUTO) |
| 11755 | setup_preset(spec, &alc269_presets[board_config]); |
| 11756 | |
| 11757 | spec->stream_name_analog = "ALC269 Analog"; |
| 11758 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 11759 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 11760 | |
| 11761 | spec->stream_name_digital = "ALC269 Digital"; |
| 11762 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 11763 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 11764 | |
| 11765 | spec->adc_nids = alc269_adc_nids; |
| 11766 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 11767 | spec->capsrc_nids = alc269_capsrc_nids; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11768 | |
| 11769 | codec->patch_ops = alc_patch_ops; |
| 11770 | if (board_config == ALC269_AUTO) |
| 11771 | spec->init_hook = alc269_auto_init; |
| 11772 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11773 | if (!spec->loopback.amplist) |
| 11774 | spec->loopback.amplist = alc269_loopbacks; |
| 11775 | #endif |
| 11776 | |
| 11777 | return 0; |
| 11778 | } |
| 11779 | |
| 11780 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11781 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 11782 | */ |
| 11783 | |
| 11784 | /* |
| 11785 | * set the path ways for 2 channel output |
| 11786 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 11787 | */ |
| 11788 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 11789 | /* set pin widget 1Ah (line in) for input */ |
| 11790 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11791 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11792 | * the vref |
| 11793 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11794 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11795 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11796 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11797 | #if 0 |
| 11798 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11799 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11800 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11801 | { } /* end */ |
| 11802 | }; |
| 11803 | /* |
| 11804 | * 6ch mode |
| 11805 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 11806 | */ |
| 11807 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 11808 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11809 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11810 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11811 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11812 | |
| 11813 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11814 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11815 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11816 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11817 | #if 0 |
| 11818 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11819 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11820 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11821 | { } /* end */ |
| 11822 | }; |
| 11823 | |
| 11824 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 11825 | { 2, alc861_threestack_ch2_init }, |
| 11826 | { 6, alc861_threestack_ch6_init }, |
| 11827 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11828 | /* Set mic1 as input and unmute the mixer */ |
| 11829 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 11830 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11831 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11832 | { } /* end */ |
| 11833 | }; |
| 11834 | /* Set mic1 as output and mute mixer */ |
| 11835 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 11836 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11837 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11838 | { } /* end */ |
| 11839 | }; |
| 11840 | |
| 11841 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 11842 | { 2, alc861_uniwill_m31_ch2_init }, |
| 11843 | { 4, alc861_uniwill_m31_ch4_init }, |
| 11844 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11845 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11846 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 11847 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 11848 | /* set pin widget 1Ah (line in) for input */ |
| 11849 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11850 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11851 | * the vref |
| 11852 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11853 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11854 | |
| 11855 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11856 | #if 0 |
| 11857 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11858 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11859 | #endif |
| 11860 | { } /* end */ |
| 11861 | }; |
| 11862 | /* Set mic1 nad line-in as output and mute mixer */ |
| 11863 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 11864 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11865 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11866 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11867 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11868 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11869 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11870 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11871 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11872 | |
| 11873 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11874 | #if 0 |
| 11875 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11876 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11877 | #endif |
| 11878 | { } /* end */ |
| 11879 | }; |
| 11880 | |
| 11881 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 11882 | { 2, alc861_asus_ch2_init }, |
| 11883 | { 6, alc861_asus_ch6_init }, |
| 11884 | }; |
| 11885 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11886 | /* patch-ALC861 */ |
| 11887 | |
| 11888 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 11889 | /* output mixer control */ |
| 11890 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11891 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11892 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11893 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11894 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11895 | |
| 11896 | /*Input mixer control */ |
| 11897 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11898 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11899 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11900 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11901 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11902 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11903 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11904 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11905 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11906 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11907 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11908 | /* Capture mixer control */ |
| 11909 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11910 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11911 | { |
| 11912 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11913 | .name = "Capture Source", |
| 11914 | .count = 1, |
| 11915 | .info = alc_mux_enum_info, |
| 11916 | .get = alc_mux_enum_get, |
| 11917 | .put = alc_mux_enum_put, |
| 11918 | }, |
| 11919 | { } /* end */ |
| 11920 | }; |
| 11921 | |
| 11922 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 11923 | /* output mixer control */ |
| 11924 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11925 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11926 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11927 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11928 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11929 | |
| 11930 | /* Input mixer control */ |
| 11931 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11932 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11933 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11934 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11935 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11936 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11937 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11938 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11939 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11940 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11941 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11942 | /* Capture mixer control */ |
| 11943 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11944 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11945 | { |
| 11946 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11947 | .name = "Capture Source", |
| 11948 | .count = 1, |
| 11949 | .info = alc_mux_enum_info, |
| 11950 | .get = alc_mux_enum_get, |
| 11951 | .put = alc_mux_enum_put, |
| 11952 | }, |
| 11953 | { |
| 11954 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11955 | .name = "Channel Mode", |
| 11956 | .info = alc_ch_mode_info, |
| 11957 | .get = alc_ch_mode_get, |
| 11958 | .put = alc_ch_mode_put, |
| 11959 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 11960 | }, |
| 11961 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11962 | }; |
| 11963 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11964 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11965 | /* output mixer control */ |
| 11966 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11967 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11968 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11969 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11970 | /*Capture mixer control */ |
| 11971 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11972 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11973 | { |
| 11974 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11975 | .name = "Capture Source", |
| 11976 | .count = 1, |
| 11977 | .info = alc_mux_enum_info, |
| 11978 | .get = alc_mux_enum_get, |
| 11979 | .put = alc_mux_enum_put, |
| 11980 | }, |
| 11981 | |
| 11982 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11983 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11984 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11985 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 11986 | /* output mixer control */ |
| 11987 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11988 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11989 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11990 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11991 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11992 | |
| 11993 | /* Input mixer control */ |
| 11994 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11995 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11996 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11997 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11999 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12001 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12002 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12003 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12004 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12005 | /* Capture mixer control */ |
| 12006 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12007 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12008 | { |
| 12009 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12010 | .name = "Capture Source", |
| 12011 | .count = 1, |
| 12012 | .info = alc_mux_enum_info, |
| 12013 | .get = alc_mux_enum_get, |
| 12014 | .put = alc_mux_enum_put, |
| 12015 | }, |
| 12016 | { |
| 12017 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12018 | .name = "Channel Mode", |
| 12019 | .info = alc_ch_mode_info, |
| 12020 | .get = alc_ch_mode_get, |
| 12021 | .put = alc_ch_mode_put, |
| 12022 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12023 | }, |
| 12024 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12025 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12026 | |
| 12027 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 12028 | /* output mixer control */ |
| 12029 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12030 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12031 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12032 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12033 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12034 | |
| 12035 | /* Input mixer control */ |
| 12036 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12037 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12038 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12039 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12040 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12041 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12042 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12043 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12044 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12045 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 12046 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12047 | /* Capture mixer control */ |
| 12048 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12049 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12050 | { |
| 12051 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12052 | .name = "Capture Source", |
| 12053 | .count = 1, |
| 12054 | .info = alc_mux_enum_info, |
| 12055 | .get = alc_mux_enum_get, |
| 12056 | .put = alc_mux_enum_put, |
| 12057 | }, |
| 12058 | { |
| 12059 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12060 | .name = "Channel Mode", |
| 12061 | .info = alc_ch_mode_info, |
| 12062 | .get = alc_ch_mode_get, |
| 12063 | .put = alc_ch_mode_put, |
| 12064 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 12065 | }, |
| 12066 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12067 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12068 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12069 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12070 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12071 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12072 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12073 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12074 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12075 | { } |
| 12076 | }; |
| 12077 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12078 | /* |
| 12079 | * generic initialization of ADC, input mixers and output mixers |
| 12080 | */ |
| 12081 | static struct hda_verb alc861_base_init_verbs[] = { |
| 12082 | /* |
| 12083 | * Unmute ADC0 and set the default input to mic-in |
| 12084 | */ |
| 12085 | /* port-A for surround (rear panel) */ |
| 12086 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12087 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12088 | /* port-B for mic-in (rear panel) with vref */ |
| 12089 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12090 | /* port-C for line-in (rear panel) */ |
| 12091 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12092 | /* port-D for Front */ |
| 12093 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12094 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12095 | /* port-E for HP out (front panel) */ |
| 12096 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12097 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12098 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12099 | /* port-F for mic-in (front panel) with vref */ |
| 12100 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12101 | /* port-G for CLFE (rear panel) */ |
| 12102 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12103 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12104 | /* port-H for side (rear panel) */ |
| 12105 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12106 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12107 | /* CD-in */ |
| 12108 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12109 | /* route front mic to ADC1*/ |
| 12110 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12111 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12112 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12113 | /* Unmute DAC0~3 & spdif out*/ |
| 12114 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12115 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12116 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12117 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12118 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12119 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12120 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12121 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12122 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12123 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12124 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12125 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12126 | /* Unmute Stereo Mixer 15 */ |
| 12127 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12128 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12129 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12130 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12131 | |
| 12132 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12133 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12134 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12135 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12136 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12137 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12138 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12139 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12140 | /* hp used DAC 3 (Front) */ |
| 12141 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12142 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12143 | |
| 12144 | { } |
| 12145 | }; |
| 12146 | |
| 12147 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 12148 | /* |
| 12149 | * Unmute ADC0 and set the default input to mic-in |
| 12150 | */ |
| 12151 | /* port-A for surround (rear panel) */ |
| 12152 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12153 | /* port-B for mic-in (rear panel) with vref */ |
| 12154 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12155 | /* port-C for line-in (rear panel) */ |
| 12156 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12157 | /* port-D for Front */ |
| 12158 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12159 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12160 | /* port-E for HP out (front panel) */ |
| 12161 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12162 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12163 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12164 | /* port-F for mic-in (front panel) with vref */ |
| 12165 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12166 | /* port-G for CLFE (rear panel) */ |
| 12167 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12168 | /* port-H for side (rear panel) */ |
| 12169 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12170 | /* CD-in */ |
| 12171 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12172 | /* route front mic to ADC1*/ |
| 12173 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12174 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12175 | /* Unmute DAC0~3 & spdif out*/ |
| 12176 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12177 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12178 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12179 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12180 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12181 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12182 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12183 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12184 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12185 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12186 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12187 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12188 | /* Unmute Stereo Mixer 15 */ |
| 12189 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12190 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12191 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12192 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12193 | |
| 12194 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12195 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12196 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12197 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12198 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12199 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12200 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12201 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12202 | /* hp used DAC 3 (Front) */ |
| 12203 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12204 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12205 | { } |
| 12206 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12207 | |
| 12208 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 12209 | /* |
| 12210 | * Unmute ADC0 and set the default input to mic-in |
| 12211 | */ |
| 12212 | /* port-A for surround (rear panel) */ |
| 12213 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12214 | /* port-B for mic-in (rear panel) with vref */ |
| 12215 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12216 | /* port-C for line-in (rear panel) */ |
| 12217 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12218 | /* port-D for Front */ |
| 12219 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12220 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12221 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12222 | /* this has to be set to VREF80 */ |
| 12223 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12224 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12225 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12226 | /* port-F for mic-in (front panel) with vref */ |
| 12227 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12228 | /* port-G for CLFE (rear panel) */ |
| 12229 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12230 | /* port-H for side (rear panel) */ |
| 12231 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12232 | /* CD-in */ |
| 12233 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12234 | /* route front mic to ADC1*/ |
| 12235 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12236 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12237 | /* Unmute DAC0~3 & spdif out*/ |
| 12238 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12239 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12240 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12241 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12242 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12243 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12244 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12245 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12246 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12247 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12248 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12249 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12250 | /* Unmute Stereo Mixer 15 */ |
| 12251 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12252 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12253 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12254 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12255 | |
| 12256 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12257 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12258 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12259 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12260 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12261 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12262 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12263 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12264 | /* hp used DAC 3 (Front) */ |
| 12265 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12266 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12267 | { } |
| 12268 | }; |
| 12269 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12270 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 12271 | /* |
| 12272 | * Unmute ADC0 and set the default input to mic-in |
| 12273 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12274 | /* port-A for surround (rear panel) |
| 12275 | * according to codec#0 this is the HP jack |
| 12276 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12277 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 12278 | /* route front PCM to HP */ |
| 12279 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12280 | /* port-B for mic-in (rear panel) with vref */ |
| 12281 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12282 | /* port-C for line-in (rear panel) */ |
| 12283 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12284 | /* port-D for Front */ |
| 12285 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12286 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12287 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12288 | /* this has to be set to VREF80 */ |
| 12289 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12290 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12291 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12292 | /* port-F for mic-in (front panel) with vref */ |
| 12293 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12294 | /* port-G for CLFE (rear panel) */ |
| 12295 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12296 | /* port-H for side (rear panel) */ |
| 12297 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12298 | /* CD-in */ |
| 12299 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12300 | /* route front mic to ADC1*/ |
| 12301 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12302 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12303 | /* Unmute DAC0~3 & spdif out*/ |
| 12304 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12305 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12306 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12307 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12308 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12309 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12310 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12311 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12312 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12313 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12314 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12315 | /* Unmute Stereo Mixer 15 */ |
| 12316 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12317 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12318 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12319 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12320 | |
| 12321 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12322 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12323 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12324 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12325 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12326 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12327 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12328 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12329 | /* hp used DAC 3 (Front) */ |
| 12330 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12331 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12332 | { } |
| 12333 | }; |
| 12334 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12335 | /* additional init verbs for ASUS laptops */ |
| 12336 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 12337 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 12338 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 12339 | { } |
| 12340 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12341 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12342 | /* |
| 12343 | * generic initialization of ADC, input mixers and output mixers |
| 12344 | */ |
| 12345 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 12346 | /* |
| 12347 | * Unmute ADC0 and set the default input to mic-in |
| 12348 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12349 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12350 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12351 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12352 | /* Unmute DAC0~3 & spdif out*/ |
| 12353 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12354 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12355 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12356 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12357 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12358 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12359 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12360 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12361 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12362 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12363 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12364 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12365 | /* Unmute Stereo Mixer 15 */ |
| 12366 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12367 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12368 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12369 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 12370 | |
| 12371 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12372 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12373 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12374 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12375 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12376 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12377 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12378 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12379 | |
| 12380 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12381 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12382 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12383 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12384 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12385 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12386 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12387 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12388 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12389 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12390 | |
| 12391 | { } |
| 12392 | }; |
| 12393 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12394 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 12395 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12396 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12397 | { } |
| 12398 | }; |
| 12399 | |
| 12400 | /* toggle speaker-output according to the hp-jack state */ |
| 12401 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 12402 | { |
| 12403 | unsigned int present; |
| 12404 | |
| 12405 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 12406 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12407 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 12408 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 12409 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 12410 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12411 | } |
| 12412 | |
| 12413 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 12414 | unsigned int res) |
| 12415 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12416 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12417 | alc861_toshiba_automute(codec); |
| 12418 | } |
| 12419 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12420 | /* pcm configuration: identiacal with ALC880 */ |
| 12421 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 12422 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 12423 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 12424 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 12425 | |
| 12426 | |
| 12427 | #define ALC861_DIGOUT_NID 0x07 |
| 12428 | |
| 12429 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 12430 | { 8, NULL } |
| 12431 | }; |
| 12432 | |
| 12433 | static hda_nid_t alc861_dac_nids[4] = { |
| 12434 | /* front, surround, clfe, side */ |
| 12435 | 0x03, 0x06, 0x05, 0x04 |
| 12436 | }; |
| 12437 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12438 | static hda_nid_t alc660_dac_nids[3] = { |
| 12439 | /* front, clfe, surround */ |
| 12440 | 0x03, 0x05, 0x06 |
| 12441 | }; |
| 12442 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12443 | static hda_nid_t alc861_adc_nids[1] = { |
| 12444 | /* ADC0-2 */ |
| 12445 | 0x08, |
| 12446 | }; |
| 12447 | |
| 12448 | static struct hda_input_mux alc861_capture_source = { |
| 12449 | .num_items = 5, |
| 12450 | .items = { |
| 12451 | { "Mic", 0x0 }, |
| 12452 | { "Front Mic", 0x3 }, |
| 12453 | { "Line", 0x1 }, |
| 12454 | { "CD", 0x4 }, |
| 12455 | { "Mixer", 0x5 }, |
| 12456 | }, |
| 12457 | }; |
| 12458 | |
| 12459 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12460 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 12461 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12462 | { |
| 12463 | int i; |
| 12464 | hda_nid_t nid; |
| 12465 | |
| 12466 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12467 | for (i = 0; i < cfg->line_outs; i++) { |
| 12468 | nid = cfg->line_out_pins[i]; |
| 12469 | if (nid) { |
| 12470 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 12471 | continue; |
| 12472 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 12473 | } |
| 12474 | } |
| 12475 | spec->multiout.num_dacs = cfg->line_outs; |
| 12476 | return 0; |
| 12477 | } |
| 12478 | |
| 12479 | /* add playback controls from the parsed DAC table */ |
| 12480 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12481 | const struct auto_pin_cfg *cfg) |
| 12482 | { |
| 12483 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12484 | static const char *chname[4] = { |
| 12485 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 12486 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12487 | hda_nid_t nid; |
| 12488 | int i, idx, err; |
| 12489 | |
| 12490 | for (i = 0; i < cfg->line_outs; i++) { |
| 12491 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12492 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12493 | continue; |
| 12494 | if (nid == 0x05) { |
| 12495 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12496 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12497 | "Center Playback Switch", |
| 12498 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 12499 | HDA_OUTPUT)); |
| 12500 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12501 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12502 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12503 | "LFE Playback Switch", |
| 12504 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12505 | HDA_OUTPUT)); |
| 12506 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12507 | return err; |
| 12508 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12509 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 12510 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12511 | if (nid == alc861_dac_nids[idx]) |
| 12512 | break; |
| 12513 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12514 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12515 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12516 | HDA_OUTPUT)); |
| 12517 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12518 | return err; |
| 12519 | } |
| 12520 | } |
| 12521 | return 0; |
| 12522 | } |
| 12523 | |
| 12524 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 12525 | { |
| 12526 | int err; |
| 12527 | hda_nid_t nid; |
| 12528 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12529 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12530 | return 0; |
| 12531 | |
| 12532 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 12533 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12534 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12535 | "Headphone Playback Switch", |
| 12536 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12537 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12538 | return err; |
| 12539 | spec->multiout.hp_nid = nid; |
| 12540 | } |
| 12541 | return 0; |
| 12542 | } |
| 12543 | |
| 12544 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12545 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12546 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12547 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12548 | struct hda_input_mux *imux = &spec->private_imux; |
| 12549 | int i, err, idx, idx1; |
| 12550 | |
| 12551 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12552 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12553 | case 0x0c: |
| 12554 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12555 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12556 | break; |
| 12557 | case 0x0f: |
| 12558 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12559 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12560 | break; |
| 12561 | case 0x0d: |
| 12562 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12563 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12564 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12565 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12566 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12567 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12568 | break; |
| 12569 | case 0x11: |
| 12570 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12571 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12572 | break; |
| 12573 | default: |
| 12574 | continue; |
| 12575 | } |
| 12576 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 12577 | err = new_analog_input(spec, cfg->input_pins[i], |
| 12578 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12579 | if (err < 0) |
| 12580 | return err; |
| 12581 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 12582 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12583 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12584 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12585 | } |
| 12586 | return 0; |
| 12587 | } |
| 12588 | |
| 12589 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 12590 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12591 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12592 | |
| 12593 | { |
| 12594 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12595 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12596 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12597 | */ |
| 12598 | /* .name = "Capture Source", */ |
| 12599 | .name = "Input Source", |
| 12600 | .count = 1, |
| 12601 | .info = alc_mux_enum_info, |
| 12602 | .get = alc_mux_enum_get, |
| 12603 | .put = alc_mux_enum_put, |
| 12604 | }, |
| 12605 | { } /* end */ |
| 12606 | }; |
| 12607 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12608 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12609 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12610 | int pin_type, int dac_idx) |
| 12611 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 12612 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12613 | pin_type); |
| 12614 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12615 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12616 | } |
| 12617 | |
| 12618 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 12619 | { |
| 12620 | struct alc_spec *spec = codec->spec; |
| 12621 | int i; |
| 12622 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12623 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12624 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 12625 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12626 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12627 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12628 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12629 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12630 | } |
| 12631 | } |
| 12632 | |
| 12633 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 12634 | { |
| 12635 | struct alc_spec *spec = codec->spec; |
| 12636 | hda_nid_t pin; |
| 12637 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 12638 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12639 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12640 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 12641 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12642 | pin = spec->autocfg.speaker_pins[0]; |
| 12643 | if (pin) |
| 12644 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12645 | } |
| 12646 | |
| 12647 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 12648 | { |
| 12649 | struct alc_spec *spec = codec->spec; |
| 12650 | int i; |
| 12651 | |
| 12652 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12653 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12654 | if (nid >= 0x0c && nid <= 0x11) { |
| 12655 | snd_hda_codec_write(codec, nid, 0, |
| 12656 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12657 | i <= AUTO_PIN_FRONT_MIC ? |
| 12658 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12659 | } |
| 12660 | } |
| 12661 | } |
| 12662 | |
| 12663 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12664 | /* return 1 if successful, 0 if the proper config is not found, |
| 12665 | * or a negative error code |
| 12666 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12667 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 12668 | { |
| 12669 | struct alc_spec *spec = codec->spec; |
| 12670 | int err; |
| 12671 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 12672 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12673 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12674 | alc861_ignore); |
| 12675 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12676 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12677 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12678 | return 0; /* can't find valid BIOS pin config */ |
| 12679 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12680 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12681 | if (err < 0) |
| 12682 | return err; |
| 12683 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12684 | if (err < 0) |
| 12685 | return err; |
| 12686 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 12687 | if (err < 0) |
| 12688 | return err; |
| 12689 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12690 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12691 | return err; |
| 12692 | |
| 12693 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12694 | |
| 12695 | if (spec->autocfg.dig_out_pin) |
| 12696 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 12697 | |
| 12698 | if (spec->kctl_alloc) |
| 12699 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12700 | |
| 12701 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 12702 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12703 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12704 | spec->input_mux = &spec->private_imux; |
| 12705 | |
| 12706 | spec->adc_nids = alc861_adc_nids; |
| 12707 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 12708 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 12709 | spec->num_mixers++; |
| 12710 | |
| 12711 | return 1; |
| 12712 | } |
| 12713 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12714 | /* additional initialization for auto-configuration model */ |
| 12715 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12716 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12717 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12718 | alc861_auto_init_multi_out(codec); |
| 12719 | alc861_auto_init_hp_out(codec); |
| 12720 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12721 | if (spec->unsol_event) |
| 12722 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12723 | } |
| 12724 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12725 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12726 | static struct hda_amp_list alc861_loopbacks[] = { |
| 12727 | { 0x15, HDA_INPUT, 0 }, |
| 12728 | { 0x15, HDA_INPUT, 1 }, |
| 12729 | { 0x15, HDA_INPUT, 2 }, |
| 12730 | { 0x15, HDA_INPUT, 3 }, |
| 12731 | { } /* end */ |
| 12732 | }; |
| 12733 | #endif |
| 12734 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12735 | |
| 12736 | /* |
| 12737 | * configuration and preset |
| 12738 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12739 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 12740 | [ALC861_3ST] = "3stack", |
| 12741 | [ALC660_3ST] = "3stack-660", |
| 12742 | [ALC861_3ST_DIG] = "3stack-dig", |
| 12743 | [ALC861_6ST_DIG] = "6stack-dig", |
| 12744 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 12745 | [ALC861_TOSHIBA] = "toshiba", |
| 12746 | [ALC861_ASUS] = "asus", |
| 12747 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 12748 | [ALC861_AUTO] = "auto", |
| 12749 | }; |
| 12750 | |
| 12751 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 12752 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12753 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12754 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12755 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12756 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12757 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 12758 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 12759 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 12760 | * Any other models that need this preset? |
| 12761 | */ |
| 12762 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 12763 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 12764 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12765 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 12766 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 12767 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 12768 | /* FIXME: the below seems conflict */ |
| 12769 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 12770 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 12771 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12772 | {} |
| 12773 | }; |
| 12774 | |
| 12775 | static struct alc_config_preset alc861_presets[] = { |
| 12776 | [ALC861_3ST] = { |
| 12777 | .mixers = { alc861_3ST_mixer }, |
| 12778 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12779 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12780 | .dac_nids = alc861_dac_nids, |
| 12781 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12782 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12783 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12784 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12785 | .adc_nids = alc861_adc_nids, |
| 12786 | .input_mux = &alc861_capture_source, |
| 12787 | }, |
| 12788 | [ALC861_3ST_DIG] = { |
| 12789 | .mixers = { alc861_base_mixer }, |
| 12790 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12791 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12792 | .dac_nids = alc861_dac_nids, |
| 12793 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12794 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12795 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12796 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12797 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12798 | .adc_nids = alc861_adc_nids, |
| 12799 | .input_mux = &alc861_capture_source, |
| 12800 | }, |
| 12801 | [ALC861_6ST_DIG] = { |
| 12802 | .mixers = { alc861_base_mixer }, |
| 12803 | .init_verbs = { alc861_base_init_verbs }, |
| 12804 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12805 | .dac_nids = alc861_dac_nids, |
| 12806 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12807 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 12808 | .channel_mode = alc861_8ch_modes, |
| 12809 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12810 | .adc_nids = alc861_adc_nids, |
| 12811 | .input_mux = &alc861_capture_source, |
| 12812 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12813 | [ALC660_3ST] = { |
| 12814 | .mixers = { alc861_3ST_mixer }, |
| 12815 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12816 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 12817 | .dac_nids = alc660_dac_nids, |
| 12818 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12819 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12820 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12821 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12822 | .adc_nids = alc861_adc_nids, |
| 12823 | .input_mux = &alc861_capture_source, |
| 12824 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12825 | [ALC861_UNIWILL_M31] = { |
| 12826 | .mixers = { alc861_uniwill_m31_mixer }, |
| 12827 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 12828 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12829 | .dac_nids = alc861_dac_nids, |
| 12830 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12831 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12832 | .channel_mode = alc861_uniwill_m31_modes, |
| 12833 | .need_dac_fix = 1, |
| 12834 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12835 | .adc_nids = alc861_adc_nids, |
| 12836 | .input_mux = &alc861_capture_source, |
| 12837 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12838 | [ALC861_TOSHIBA] = { |
| 12839 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12840 | .init_verbs = { alc861_base_init_verbs, |
| 12841 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12842 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12843 | .dac_nids = alc861_dac_nids, |
| 12844 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12845 | .channel_mode = alc883_3ST_2ch_modes, |
| 12846 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12847 | .adc_nids = alc861_adc_nids, |
| 12848 | .input_mux = &alc861_capture_source, |
| 12849 | .unsol_event = alc861_toshiba_unsol_event, |
| 12850 | .init_hook = alc861_toshiba_automute, |
| 12851 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12852 | [ALC861_ASUS] = { |
| 12853 | .mixers = { alc861_asus_mixer }, |
| 12854 | .init_verbs = { alc861_asus_init_verbs }, |
| 12855 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12856 | .dac_nids = alc861_dac_nids, |
| 12857 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12858 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 12859 | .channel_mode = alc861_asus_modes, |
| 12860 | .need_dac_fix = 1, |
| 12861 | .hp_nid = 0x06, |
| 12862 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12863 | .adc_nids = alc861_adc_nids, |
| 12864 | .input_mux = &alc861_capture_source, |
| 12865 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12866 | [ALC861_ASUS_LAPTOP] = { |
| 12867 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 12868 | .init_verbs = { alc861_asus_init_verbs, |
| 12869 | alc861_asus_laptop_init_verbs }, |
| 12870 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12871 | .dac_nids = alc861_dac_nids, |
| 12872 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12873 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12874 | .channel_mode = alc883_3ST_2ch_modes, |
| 12875 | .need_dac_fix = 1, |
| 12876 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12877 | .adc_nids = alc861_adc_nids, |
| 12878 | .input_mux = &alc861_capture_source, |
| 12879 | }, |
| 12880 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12881 | |
| 12882 | |
| 12883 | static int patch_alc861(struct hda_codec *codec) |
| 12884 | { |
| 12885 | struct alc_spec *spec; |
| 12886 | int board_config; |
| 12887 | int err; |
| 12888 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12889 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12890 | if (spec == NULL) |
| 12891 | return -ENOMEM; |
| 12892 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12893 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12894 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12895 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 12896 | alc861_models, |
| 12897 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12898 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12899 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12900 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 12901 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12902 | board_config = ALC861_AUTO; |
| 12903 | } |
| 12904 | |
| 12905 | if (board_config == ALC861_AUTO) { |
| 12906 | /* automatic parse from the BIOS config */ |
| 12907 | err = alc861_parse_auto_config(codec); |
| 12908 | if (err < 0) { |
| 12909 | alc_free(codec); |
| 12910 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12911 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12912 | printk(KERN_INFO |
| 12913 | "hda_codec: Cannot set up configuration " |
| 12914 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12915 | board_config = ALC861_3ST_DIG; |
| 12916 | } |
| 12917 | } |
| 12918 | |
| 12919 | if (board_config != ALC861_AUTO) |
| 12920 | setup_preset(spec, &alc861_presets[board_config]); |
| 12921 | |
| 12922 | spec->stream_name_analog = "ALC861 Analog"; |
| 12923 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 12924 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 12925 | |
| 12926 | spec->stream_name_digital = "ALC861 Digital"; |
| 12927 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 12928 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 12929 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12930 | spec->vmaster_nid = 0x03; |
| 12931 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12932 | codec->patch_ops = alc_patch_ops; |
| 12933 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12934 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12935 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12936 | if (!spec->loopback.amplist) |
| 12937 | spec->loopback.amplist = alc861_loopbacks; |
| 12938 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12939 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12940 | return 0; |
| 12941 | } |
| 12942 | |
| 12943 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12944 | * ALC861-VD support |
| 12945 | * |
| 12946 | * Based on ALC882 |
| 12947 | * |
| 12948 | * In addition, an independent DAC |
| 12949 | */ |
| 12950 | #define ALC861VD_DIGOUT_NID 0x06 |
| 12951 | |
| 12952 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 12953 | /* front, surr, clfe, side surr */ |
| 12954 | 0x02, 0x03, 0x04, 0x05 |
| 12955 | }; |
| 12956 | |
| 12957 | /* dac_nids for ALC660vd are in a different order - according to |
| 12958 | * Realtek's driver. |
| 12959 | * This should probably tesult in a different mixer for 6stack models |
| 12960 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 12961 | * - and it is the same as in 861vd. |
| 12962 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 12963 | */ |
| 12964 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 12965 | /* front, rear, clfe, rear_surr */ |
| 12966 | 0x02, 0x04, 0x03 |
| 12967 | }; |
| 12968 | |
| 12969 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 12970 | /* ADC0 */ |
| 12971 | 0x09, |
| 12972 | }; |
| 12973 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12974 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 12975 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12976 | /* input MUX */ |
| 12977 | /* FIXME: should be a matrix-type input source selection */ |
| 12978 | static struct hda_input_mux alc861vd_capture_source = { |
| 12979 | .num_items = 4, |
| 12980 | .items = { |
| 12981 | { "Mic", 0x0 }, |
| 12982 | { "Front Mic", 0x1 }, |
| 12983 | { "Line", 0x2 }, |
| 12984 | { "CD", 0x4 }, |
| 12985 | }, |
| 12986 | }; |
| 12987 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12988 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12989 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12990 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12991 | { "Ext Mic", 0x0 }, |
| 12992 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12993 | }, |
| 12994 | }; |
| 12995 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12996 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 12997 | .num_items = 2, |
| 12998 | .items = { |
| 12999 | { "Front Mic", 0x0 }, |
| 13000 | { "ATAPI Mic", 0x1 }, |
| 13001 | }, |
| 13002 | }; |
| 13003 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13004 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 13005 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13006 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 13007 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13008 | |
| 13009 | /* |
| 13010 | * 2ch mode |
| 13011 | */ |
| 13012 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 13013 | { 2, NULL } |
| 13014 | }; |
| 13015 | |
| 13016 | /* |
| 13017 | * 6ch mode |
| 13018 | */ |
| 13019 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 13020 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13021 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13022 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13023 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13024 | { } /* end */ |
| 13025 | }; |
| 13026 | |
| 13027 | /* |
| 13028 | * 8ch mode |
| 13029 | */ |
| 13030 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 13031 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13032 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13033 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13034 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13035 | { } /* end */ |
| 13036 | }; |
| 13037 | |
| 13038 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 13039 | { 6, alc861vd_6stack_ch6_init }, |
| 13040 | { 8, alc861vd_6stack_ch8_init }, |
| 13041 | }; |
| 13042 | |
| 13043 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 13044 | { |
| 13045 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13046 | .name = "Channel Mode", |
| 13047 | .info = alc_ch_mode_info, |
| 13048 | .get = alc_ch_mode_get, |
| 13049 | .put = alc_ch_mode_put, |
| 13050 | }, |
| 13051 | { } /* end */ |
| 13052 | }; |
| 13053 | |
| 13054 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 13055 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13056 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13057 | |
| 13058 | { |
| 13059 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13060 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13061 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13062 | */ |
| 13063 | /* .name = "Capture Source", */ |
| 13064 | .name = "Input Source", |
| 13065 | .count = 1, |
| 13066 | .info = alc861vd_mux_enum_info, |
| 13067 | .get = alc861vd_mux_enum_get, |
| 13068 | .put = alc861vd_mux_enum_put, |
| 13069 | }, |
| 13070 | { } /* end */ |
| 13071 | }; |
| 13072 | |
| 13073 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13074 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13075 | */ |
| 13076 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 13077 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13078 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13079 | |
| 13080 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13081 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13082 | |
| 13083 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 13084 | HDA_OUTPUT), |
| 13085 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 13086 | HDA_OUTPUT), |
| 13087 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13088 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 13089 | |
| 13090 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 13091 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13092 | |
| 13093 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13094 | |
| 13095 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13096 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13097 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13098 | |
| 13099 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13100 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13101 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13102 | |
| 13103 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13104 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13105 | |
| 13106 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13107 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13108 | |
| 13109 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13110 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13111 | |
| 13112 | { } /* end */ |
| 13113 | }; |
| 13114 | |
| 13115 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 13116 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13117 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13118 | |
| 13119 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13120 | |
| 13121 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13122 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13123 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13124 | |
| 13125 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13126 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13127 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13128 | |
| 13129 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13130 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13131 | |
| 13132 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13133 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13134 | |
| 13135 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13136 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13137 | |
| 13138 | { } /* end */ |
| 13139 | }; |
| 13140 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13141 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 13142 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13143 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 13144 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13145 | |
| 13146 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13147 | |
| 13148 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13149 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13150 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13151 | |
| 13152 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13153 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13154 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13155 | |
| 13156 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13157 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13158 | |
| 13159 | { } /* end */ |
| 13160 | }; |
| 13161 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13162 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 13163 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13164 | */ |
| 13165 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13166 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13167 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13168 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13169 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13170 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13171 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13172 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13173 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13174 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13175 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13176 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 13177 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13178 | { } /* end */ |
| 13179 | }; |
| 13180 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13181 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 13182 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 13183 | */ |
| 13184 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 13185 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13186 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13187 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13188 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13189 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13190 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13191 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13192 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13193 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13194 | { } /* end */ |
| 13195 | }; |
| 13196 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13197 | /* |
| 13198 | * generic initialization of ADC, input mixers and output mixers |
| 13199 | */ |
| 13200 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 13201 | /* |
| 13202 | * Unmute ADC0 and set the default input to mic-in |
| 13203 | */ |
| 13204 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13205 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13206 | |
| 13207 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 13208 | * the analog-loopback mixer widget |
| 13209 | */ |
| 13210 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13211 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13212 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13213 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13214 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13215 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13216 | |
| 13217 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13218 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13219 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13220 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13221 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13222 | |
| 13223 | /* |
| 13224 | * Set up output mixers (0x02 - 0x05) |
| 13225 | */ |
| 13226 | /* set vol=0 to output mixers */ |
| 13227 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13228 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13229 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13230 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13231 | |
| 13232 | /* set up input amps for analog loopback */ |
| 13233 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13234 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13235 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13236 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13237 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13238 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13239 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13240 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13241 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13242 | |
| 13243 | { } |
| 13244 | }; |
| 13245 | |
| 13246 | /* |
| 13247 | * 3-stack pin configuration: |
| 13248 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 13249 | */ |
| 13250 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 13251 | /* |
| 13252 | * Set pin mode and muting |
| 13253 | */ |
| 13254 | /* set front pin widgets 0x14 for output */ |
| 13255 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13256 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13257 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13258 | |
| 13259 | /* Mic (rear) pin: input vref at 80% */ |
| 13260 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13261 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13262 | /* Front Mic pin: input vref at 80% */ |
| 13263 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13264 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13265 | /* Line In pin: input */ |
| 13266 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13267 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13268 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13269 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13270 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13271 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13272 | /* CD pin widget for input */ |
| 13273 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13274 | |
| 13275 | { } |
| 13276 | }; |
| 13277 | |
| 13278 | /* |
| 13279 | * 6-stack pin configuration: |
| 13280 | */ |
| 13281 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 13282 | /* |
| 13283 | * Set pin mode and muting |
| 13284 | */ |
| 13285 | /* set front pin widgets 0x14 for output */ |
| 13286 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13287 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13288 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13289 | |
| 13290 | /* Rear Pin: output 1 (0x0d) */ |
| 13291 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13292 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13293 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13294 | /* CLFE Pin: output 2 (0x0e) */ |
| 13295 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13296 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13297 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 13298 | /* Side Pin: output 3 (0x0f) */ |
| 13299 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13300 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13301 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 13302 | |
| 13303 | /* Mic (rear) pin: input vref at 80% */ |
| 13304 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13305 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13306 | /* Front Mic pin: input vref at 80% */ |
| 13307 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13308 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13309 | /* Line In pin: input */ |
| 13310 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13311 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13312 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13313 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13314 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13315 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13316 | /* CD pin widget for input */ |
| 13317 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13318 | |
| 13319 | { } |
| 13320 | }; |
| 13321 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13322 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 13323 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13324 | { } |
| 13325 | }; |
| 13326 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 13327 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 13328 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13329 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13330 | { } |
| 13331 | }; |
| 13332 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13333 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 13334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13335 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13336 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 13337 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13338 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13339 | {} |
| 13340 | }; |
| 13341 | |
| 13342 | /* toggle speaker-output according to the hp-jack state */ |
| 13343 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 13344 | { |
| 13345 | unsigned int present; |
| 13346 | unsigned char bits; |
| 13347 | |
| 13348 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13349 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13350 | bits = present ? HDA_AMP_MUTE : 0; |
| 13351 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13352 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13353 | } |
| 13354 | |
| 13355 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 13356 | { |
| 13357 | unsigned int present; |
| 13358 | unsigned char bits; |
| 13359 | |
| 13360 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13361 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13362 | bits = present ? HDA_AMP_MUTE : 0; |
| 13363 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 13364 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13365 | } |
| 13366 | |
| 13367 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 13368 | { |
| 13369 | alc861vd_lenovo_hp_automute(codec); |
| 13370 | alc861vd_lenovo_mic_automute(codec); |
| 13371 | } |
| 13372 | |
| 13373 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 13374 | unsigned int res) |
| 13375 | { |
| 13376 | switch (res >> 26) { |
| 13377 | case ALC880_HP_EVENT: |
| 13378 | alc861vd_lenovo_hp_automute(codec); |
| 13379 | break; |
| 13380 | case ALC880_MIC_EVENT: |
| 13381 | alc861vd_lenovo_mic_automute(codec); |
| 13382 | break; |
| 13383 | } |
| 13384 | } |
| 13385 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13386 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 13387 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13388 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13389 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13390 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13391 | |
| 13392 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13393 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13394 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13395 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13396 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13397 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13398 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13399 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13400 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13401 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13402 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13403 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13404 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13405 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13406 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13407 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13408 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13409 | |
| 13410 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13411 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13412 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13413 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13414 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13415 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13416 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13417 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13418 | |
| 13419 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13420 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13421 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13422 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13423 | |
| 13424 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13425 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13426 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13427 | |
| 13428 | { } /* end */ |
| 13429 | }; |
| 13430 | |
| 13431 | /* toggle speaker-output according to the hp-jack state */ |
| 13432 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 13433 | { |
| 13434 | unsigned int present; |
| 13435 | |
| 13436 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13437 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13438 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13439 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13440 | } |
| 13441 | |
| 13442 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 13443 | { |
| 13444 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13445 | alc861vd_dallas_automute(codec); |
| 13446 | } |
| 13447 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13448 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13449 | #define alc861vd_loopbacks alc880_loopbacks |
| 13450 | #endif |
| 13451 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13452 | /* pcm configuration: identiacal with ALC880 */ |
| 13453 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 13454 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 13455 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 13456 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 13457 | |
| 13458 | /* |
| 13459 | * configuration and preset |
| 13460 | */ |
| 13461 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 13462 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13463 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13464 | [ALC861VD_3ST] = "3stack", |
| 13465 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 13466 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13467 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13468 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13469 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13470 | [ALC861VD_AUTO] = "auto", |
| 13471 | }; |
| 13472 | |
| 13473 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13474 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 13475 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 13476 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13477 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Alexander Holler | 2522d73 | 2008-07-17 23:36:15 +0200 | [diff] [blame] | 13478 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13479 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13480 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13481 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 13482 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13483 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 13484 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13485 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 13486 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13487 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 13488 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Takashi Iwai | be321a89 | 2008-07-07 16:04:04 +0200 | [diff] [blame] | 13489 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 13490 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13491 | {} |
| 13492 | }; |
| 13493 | |
| 13494 | static struct alc_config_preset alc861vd_presets[] = { |
| 13495 | [ALC660VD_3ST] = { |
| 13496 | .mixers = { alc861vd_3st_mixer }, |
| 13497 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13498 | alc861vd_3stack_init_verbs }, |
| 13499 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13500 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13501 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13502 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13503 | .input_mux = &alc861vd_capture_source, |
| 13504 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13505 | [ALC660VD_3ST_DIG] = { |
| 13506 | .mixers = { alc861vd_3st_mixer }, |
| 13507 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13508 | alc861vd_3stack_init_verbs }, |
| 13509 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13510 | .dac_nids = alc660vd_dac_nids, |
| 13511 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13512 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13513 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13514 | .input_mux = &alc861vd_capture_source, |
| 13515 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13516 | [ALC861VD_3ST] = { |
| 13517 | .mixers = { alc861vd_3st_mixer }, |
| 13518 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13519 | alc861vd_3stack_init_verbs }, |
| 13520 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13521 | .dac_nids = alc861vd_dac_nids, |
| 13522 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13523 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13524 | .input_mux = &alc861vd_capture_source, |
| 13525 | }, |
| 13526 | [ALC861VD_3ST_DIG] = { |
| 13527 | .mixers = { alc861vd_3st_mixer }, |
| 13528 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13529 | alc861vd_3stack_init_verbs }, |
| 13530 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13531 | .dac_nids = alc861vd_dac_nids, |
| 13532 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 13533 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13534 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13535 | .input_mux = &alc861vd_capture_source, |
| 13536 | }, |
| 13537 | [ALC861VD_6ST_DIG] = { |
| 13538 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 13539 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13540 | alc861vd_6stack_init_verbs }, |
| 13541 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13542 | .dac_nids = alc861vd_dac_nids, |
| 13543 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 13544 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 13545 | .channel_mode = alc861vd_6stack_modes, |
| 13546 | .input_mux = &alc861vd_capture_source, |
| 13547 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13548 | [ALC861VD_LENOVO] = { |
| 13549 | .mixers = { alc861vd_lenovo_mixer }, |
| 13550 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13551 | alc861vd_3stack_init_verbs, |
| 13552 | alc861vd_eapd_verbs, |
| 13553 | alc861vd_lenovo_unsol_verbs }, |
| 13554 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13555 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13556 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13557 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13558 | .input_mux = &alc861vd_capture_source, |
| 13559 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 13560 | .init_hook = alc861vd_lenovo_automute, |
| 13561 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13562 | [ALC861VD_DALLAS] = { |
| 13563 | .mixers = { alc861vd_dallas_mixer }, |
| 13564 | .init_verbs = { alc861vd_dallas_verbs }, |
| 13565 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13566 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13567 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13568 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13569 | .input_mux = &alc861vd_dallas_capture_source, |
| 13570 | .unsol_event = alc861vd_dallas_unsol_event, |
| 13571 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13572 | }, |
| 13573 | [ALC861VD_HP] = { |
| 13574 | .mixers = { alc861vd_hp_mixer }, |
| 13575 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 13576 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13577 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13578 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13579 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13580 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13581 | .input_mux = &alc861vd_hp_capture_source, |
| 13582 | .unsol_event = alc861vd_dallas_unsol_event, |
| 13583 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13584 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13585 | }; |
| 13586 | |
| 13587 | /* |
| 13588 | * BIOS auto configuration |
| 13589 | */ |
| 13590 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13591 | hda_nid_t nid, int pin_type, int dac_idx) |
| 13592 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13593 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13594 | } |
| 13595 | |
| 13596 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 13597 | { |
| 13598 | struct alc_spec *spec = codec->spec; |
| 13599 | int i; |
| 13600 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13601 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13602 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13603 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13604 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13605 | if (nid) |
| 13606 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13607 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13608 | } |
| 13609 | } |
| 13610 | |
| 13611 | |
| 13612 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 13613 | { |
| 13614 | struct alc_spec *spec = codec->spec; |
| 13615 | hda_nid_t pin; |
| 13616 | |
| 13617 | pin = spec->autocfg.hp_pins[0]; |
| 13618 | if (pin) /* connect to front and use dac 0 */ |
| 13619 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13620 | pin = spec->autocfg.speaker_pins[0]; |
| 13621 | if (pin) |
| 13622 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13623 | } |
| 13624 | |
| 13625 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13626 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 13627 | |
| 13628 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 13629 | { |
| 13630 | struct alc_spec *spec = codec->spec; |
| 13631 | int i; |
| 13632 | |
| 13633 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13634 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13635 | if (alc861vd_is_input_pin(nid)) { |
| 13636 | snd_hda_codec_write(codec, nid, 0, |
| 13637 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13638 | i <= AUTO_PIN_FRONT_MIC ? |
| 13639 | PIN_VREF80 : PIN_IN); |
| 13640 | if (nid != ALC861VD_PIN_CD_NID) |
| 13641 | snd_hda_codec_write(codec, nid, 0, |
| 13642 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13643 | AMP_OUT_MUTE); |
| 13644 | } |
| 13645 | } |
| 13646 | } |
| 13647 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 13648 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 13649 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13650 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 13651 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 13652 | |
| 13653 | /* add playback controls from the parsed DAC table */ |
| 13654 | /* Based on ALC880 version. But ALC861VD has separate, |
| 13655 | * different NIDs for mute/unmute switch and volume control */ |
| 13656 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13657 | const struct auto_pin_cfg *cfg) |
| 13658 | { |
| 13659 | char name[32]; |
| 13660 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 13661 | hda_nid_t nid_v, nid_s; |
| 13662 | int i, err; |
| 13663 | |
| 13664 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13665 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13666 | continue; |
| 13667 | nid_v = alc861vd_idx_to_mixer_vol( |
| 13668 | alc880_dac_to_idx( |
| 13669 | spec->multiout.dac_nids[i])); |
| 13670 | nid_s = alc861vd_idx_to_mixer_switch( |
| 13671 | alc880_dac_to_idx( |
| 13672 | spec->multiout.dac_nids[i])); |
| 13673 | |
| 13674 | if (i == 2) { |
| 13675 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13676 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13677 | "Center Playback Volume", |
| 13678 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 13679 | HDA_OUTPUT)); |
| 13680 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13681 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13682 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13683 | "LFE Playback Volume", |
| 13684 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 13685 | HDA_OUTPUT)); |
| 13686 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13687 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13688 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13689 | "Center Playback Switch", |
| 13690 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 13691 | HDA_INPUT)); |
| 13692 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13693 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13694 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13695 | "LFE Playback Switch", |
| 13696 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 13697 | HDA_INPUT)); |
| 13698 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13699 | return err; |
| 13700 | } else { |
| 13701 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13702 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13703 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 13704 | HDA_OUTPUT)); |
| 13705 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13706 | return err; |
| 13707 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13708 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13709 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13710 | HDA_INPUT)); |
| 13711 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13712 | return err; |
| 13713 | } |
| 13714 | } |
| 13715 | return 0; |
| 13716 | } |
| 13717 | |
| 13718 | /* add playback controls for speaker and HP outputs */ |
| 13719 | /* Based on ALC880 version. But ALC861VD has separate, |
| 13720 | * different NIDs for mute/unmute switch and volume control */ |
| 13721 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 13722 | hda_nid_t pin, const char *pfx) |
| 13723 | { |
| 13724 | hda_nid_t nid_v, nid_s; |
| 13725 | int err; |
| 13726 | char name[32]; |
| 13727 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13728 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13729 | return 0; |
| 13730 | |
| 13731 | if (alc880_is_fixed_pin(pin)) { |
| 13732 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13733 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13734 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13735 | spec->multiout.hp_nid = nid_v; |
| 13736 | else |
| 13737 | spec->multiout.extra_out_nid[0] = nid_v; |
| 13738 | /* control HP volume/switch on the output mixer amp */ |
| 13739 | nid_v = alc861vd_idx_to_mixer_vol( |
| 13740 | alc880_fixed_pin_idx(pin)); |
| 13741 | nid_s = alc861vd_idx_to_mixer_switch( |
| 13742 | alc880_fixed_pin_idx(pin)); |
| 13743 | |
| 13744 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13745 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13746 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 13747 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13748 | return err; |
| 13749 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13750 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13751 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 13752 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13753 | return err; |
| 13754 | } else if (alc880_is_multi_pin(pin)) { |
| 13755 | /* set manual connection */ |
| 13756 | /* we have only a switch on HP-out PIN */ |
| 13757 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13758 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13759 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13760 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13761 | return err; |
| 13762 | } |
| 13763 | return 0; |
| 13764 | } |
| 13765 | |
| 13766 | /* parse the BIOS configuration and set up the alc_spec |
| 13767 | * return 1 if successful, 0 if the proper config is not found, |
| 13768 | * or a negative error code |
| 13769 | * Based on ALC880 version - had to change it to override |
| 13770 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 13771 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 13772 | { |
| 13773 | struct alc_spec *spec = codec->spec; |
| 13774 | int err; |
| 13775 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 13776 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13777 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13778 | alc861vd_ignore); |
| 13779 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13780 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13781 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13782 | return 0; /* can't find valid BIOS pin config */ |
| 13783 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13784 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13785 | if (err < 0) |
| 13786 | return err; |
| 13787 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13788 | if (err < 0) |
| 13789 | return err; |
| 13790 | err = alc861vd_auto_create_extra_out(spec, |
| 13791 | spec->autocfg.speaker_pins[0], |
| 13792 | "Speaker"); |
| 13793 | if (err < 0) |
| 13794 | return err; |
| 13795 | err = alc861vd_auto_create_extra_out(spec, |
| 13796 | spec->autocfg.hp_pins[0], |
| 13797 | "Headphone"); |
| 13798 | if (err < 0) |
| 13799 | return err; |
| 13800 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13801 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13802 | return err; |
| 13803 | |
| 13804 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13805 | |
| 13806 | if (spec->autocfg.dig_out_pin) |
| 13807 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 13808 | |
| 13809 | if (spec->kctl_alloc) |
| 13810 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13811 | |
| 13812 | spec->init_verbs[spec->num_init_verbs++] |
| 13813 | = alc861vd_volume_init_verbs; |
| 13814 | |
| 13815 | spec->num_mux_defs = 1; |
| 13816 | spec->input_mux = &spec->private_imux; |
| 13817 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13818 | err = alc_auto_add_mic_boost(codec); |
| 13819 | if (err < 0) |
| 13820 | return err; |
| 13821 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13822 | return 1; |
| 13823 | } |
| 13824 | |
| 13825 | /* additional initialization for auto-configuration model */ |
| 13826 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 13827 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13828 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13829 | alc861vd_auto_init_multi_out(codec); |
| 13830 | alc861vd_auto_init_hp_out(codec); |
| 13831 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 13832 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13833 | if (spec->unsol_event) |
| 13834 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13835 | } |
| 13836 | |
| 13837 | static int patch_alc861vd(struct hda_codec *codec) |
| 13838 | { |
| 13839 | struct alc_spec *spec; |
| 13840 | int err, board_config; |
| 13841 | |
| 13842 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13843 | if (spec == NULL) |
| 13844 | return -ENOMEM; |
| 13845 | |
| 13846 | codec->spec = spec; |
| 13847 | |
| 13848 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 13849 | alc861vd_models, |
| 13850 | alc861vd_cfg_tbl); |
| 13851 | |
| 13852 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 13853 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 13854 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 13855 | board_config = ALC861VD_AUTO; |
| 13856 | } |
| 13857 | |
| 13858 | if (board_config == ALC861VD_AUTO) { |
| 13859 | /* automatic parse from the BIOS config */ |
| 13860 | err = alc861vd_parse_auto_config(codec); |
| 13861 | if (err < 0) { |
| 13862 | alc_free(codec); |
| 13863 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13864 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13865 | printk(KERN_INFO |
| 13866 | "hda_codec: Cannot set up configuration " |
| 13867 | "from BIOS. Using base mode...\n"); |
| 13868 | board_config = ALC861VD_3ST; |
| 13869 | } |
| 13870 | } |
| 13871 | |
| 13872 | if (board_config != ALC861VD_AUTO) |
| 13873 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 13874 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 13875 | if (codec->vendor_id == 0x10ec0660) { |
| 13876 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 13877 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 13878 | /* always turn on EAPD */ |
| 13879 | spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 13880 | } else { |
| 13881 | spec->stream_name_analog = "ALC861VD Analog"; |
| 13882 | spec->stream_name_digital = "ALC861VD Digital"; |
| 13883 | } |
| 13884 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13885 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 13886 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 13887 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13888 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 13889 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 13890 | |
| 13891 | spec->adc_nids = alc861vd_adc_nids; |
| 13892 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13893 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13894 | |
| 13895 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 13896 | spec->num_mixers++; |
| 13897 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13898 | spec->vmaster_nid = 0x02; |
| 13899 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13900 | codec->patch_ops = alc_patch_ops; |
| 13901 | |
| 13902 | if (board_config == ALC861VD_AUTO) |
| 13903 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13904 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13905 | if (!spec->loopback.amplist) |
| 13906 | spec->loopback.amplist = alc861vd_loopbacks; |
| 13907 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13908 | |
| 13909 | return 0; |
| 13910 | } |
| 13911 | |
| 13912 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13913 | * ALC662 support |
| 13914 | * |
| 13915 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 13916 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 13917 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 13918 | * 6-channel independent captures. |
| 13919 | * |
| 13920 | * In addition, an independent DAC for the multi-playback (not used in this |
| 13921 | * driver yet). |
| 13922 | */ |
| 13923 | #define ALC662_DIGOUT_NID 0x06 |
| 13924 | #define ALC662_DIGIN_NID 0x0a |
| 13925 | |
| 13926 | static hda_nid_t alc662_dac_nids[4] = { |
| 13927 | /* front, rear, clfe, rear_surr */ |
| 13928 | 0x02, 0x03, 0x04 |
| 13929 | }; |
| 13930 | |
| 13931 | static hda_nid_t alc662_adc_nids[1] = { |
| 13932 | /* ADC1-2 */ |
| 13933 | 0x09, |
| 13934 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13935 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 13936 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13937 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13938 | /* input MUX */ |
| 13939 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13940 | static struct hda_input_mux alc662_capture_source = { |
| 13941 | .num_items = 4, |
| 13942 | .items = { |
| 13943 | { "Mic", 0x0 }, |
| 13944 | { "Front Mic", 0x1 }, |
| 13945 | { "Line", 0x2 }, |
| 13946 | { "CD", 0x4 }, |
| 13947 | }, |
| 13948 | }; |
| 13949 | |
| 13950 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 13951 | .num_items = 2, |
| 13952 | .items = { |
| 13953 | { "Mic", 0x1 }, |
| 13954 | { "Line", 0x2 }, |
| 13955 | }, |
| 13956 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13957 | |
| 13958 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 13959 | .num_items = 2, |
| 13960 | .items = { |
| 13961 | { "i-Mic", 0x1 }, |
| 13962 | { "e-Mic", 0x0 }, |
| 13963 | }, |
| 13964 | }; |
| 13965 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13966 | static struct hda_input_mux alc663_capture_source = { |
| 13967 | .num_items = 3, |
| 13968 | .items = { |
| 13969 | { "Mic", 0x0 }, |
| 13970 | { "Front Mic", 0x1 }, |
| 13971 | { "Line", 0x2 }, |
| 13972 | }, |
| 13973 | }; |
| 13974 | |
| 13975 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 13976 | .num_items = 2, |
| 13977 | .items = { |
| 13978 | { "Ext-Mic", 0x0 }, |
| 13979 | { "D-Mic", 0x9 }, |
| 13980 | }, |
| 13981 | }; |
| 13982 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13983 | #define alc662_mux_enum_info alc_mux_enum_info |
| 13984 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13985 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13986 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13987 | /* |
| 13988 | * 2ch mode |
| 13989 | */ |
| 13990 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 13991 | { 2, NULL } |
| 13992 | }; |
| 13993 | |
| 13994 | /* |
| 13995 | * 2ch mode |
| 13996 | */ |
| 13997 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 13998 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 13999 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14000 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 14001 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14002 | { } /* end */ |
| 14003 | }; |
| 14004 | |
| 14005 | /* |
| 14006 | * 6ch mode |
| 14007 | */ |
| 14008 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 14009 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14010 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14011 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 14012 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14013 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14014 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14015 | { } /* end */ |
| 14016 | }; |
| 14017 | |
| 14018 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 14019 | { 2, alc662_3ST_ch2_init }, |
| 14020 | { 6, alc662_3ST_ch6_init }, |
| 14021 | }; |
| 14022 | |
| 14023 | /* |
| 14024 | * 2ch mode |
| 14025 | */ |
| 14026 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 14027 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14028 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14029 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14030 | { } /* end */ |
| 14031 | }; |
| 14032 | |
| 14033 | /* |
| 14034 | * 6ch mode |
| 14035 | */ |
| 14036 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 14037 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14038 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14039 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14040 | { } /* end */ |
| 14041 | }; |
| 14042 | |
| 14043 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 14044 | { 2, alc662_sixstack_ch6_init }, |
| 14045 | { 6, alc662_sixstack_ch8_init }, |
| 14046 | }; |
| 14047 | |
| 14048 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14049 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14050 | */ |
| 14051 | |
| 14052 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 14053 | /* output mixer control */ |
| 14054 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14055 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14056 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14057 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14058 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14059 | 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] | 14060 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14061 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14062 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14063 | |
| 14064 | /*Input mixer control */ |
| 14065 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 14066 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 14067 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 14068 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 14069 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 14070 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 14071 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 14072 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14073 | { } /* end */ |
| 14074 | }; |
| 14075 | |
| 14076 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 14077 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14078 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14079 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14080 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14081 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14082 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14083 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14084 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14085 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14086 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14087 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14088 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14089 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14090 | { } /* end */ |
| 14091 | }; |
| 14092 | |
| 14093 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 14094 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14095 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14096 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14097 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14098 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14099 | 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] | 14100 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14101 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14102 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14103 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14104 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14105 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14106 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14107 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14109 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14110 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14111 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14112 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14113 | { } /* end */ |
| 14114 | }; |
| 14115 | |
| 14116 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 14117 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14118 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14119 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14120 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14121 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14122 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14123 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14124 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14125 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14126 | { } /* end */ |
| 14127 | }; |
| 14128 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14129 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14130 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14131 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 14132 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14133 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14134 | |
| 14135 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 14136 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14137 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14138 | |
| 14139 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 14140 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14141 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14142 | { } /* end */ |
| 14143 | }; |
| 14144 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14145 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 14146 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14147 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14148 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14149 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 14150 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14151 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 14152 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 14153 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14154 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14155 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14156 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14157 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14158 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14159 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14160 | { } /* end */ |
| 14161 | }; |
| 14162 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14163 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
| 14164 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14165 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14166 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14167 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14168 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14169 | HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), |
| 14170 | { } /* end */ |
| 14171 | }; |
| 14172 | |
| 14173 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 14174 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14175 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14176 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14177 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14178 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14179 | |
| 14180 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14181 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14182 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14183 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14184 | { } /* end */ |
| 14185 | }; |
| 14186 | |
| 14187 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 14188 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14189 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14190 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14191 | |
| 14192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14194 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14195 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14196 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14197 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14198 | { } /* end */ |
| 14199 | }; |
| 14200 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14201 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 14202 | { |
| 14203 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14204 | .name = "Channel Mode", |
| 14205 | .info = alc_ch_mode_info, |
| 14206 | .get = alc_ch_mode_get, |
| 14207 | .put = alc_ch_mode_put, |
| 14208 | }, |
| 14209 | { } /* end */ |
| 14210 | }; |
| 14211 | |
| 14212 | static struct hda_verb alc662_init_verbs[] = { |
| 14213 | /* ADC: mute amp left and right */ |
| 14214 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14215 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14216 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 14217 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14218 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14219 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14220 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14221 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14222 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14223 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14226 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14227 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14228 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14229 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14230 | |
| 14231 | /* Front Pin: output 0 (0x0c) */ |
| 14232 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14233 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14234 | |
| 14235 | /* Rear Pin: output 1 (0x0d) */ |
| 14236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14238 | |
| 14239 | /* CLFE Pin: output 2 (0x0e) */ |
| 14240 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14241 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14242 | |
| 14243 | /* Mic (rear) pin: input vref at 80% */ |
| 14244 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14245 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14246 | /* Front Mic pin: input vref at 80% */ |
| 14247 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14248 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14249 | /* Line In pin: input */ |
| 14250 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14251 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14252 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14253 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14254 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14255 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14256 | /* CD pin widget for input */ |
| 14257 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14258 | |
| 14259 | /* FIXME: use matrix-type input source selection */ |
| 14260 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 14261 | /* Input mixer */ |
| 14262 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14263 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14264 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14266 | |
| 14267 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14268 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14269 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14270 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14271 | |
| 14272 | /* always trun on EAPD */ |
| 14273 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14274 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14275 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14276 | { } |
| 14277 | }; |
| 14278 | |
| 14279 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 14280 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 14281 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14282 | {} |
| 14283 | }; |
| 14284 | |
| 14285 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 14286 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14287 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14288 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14289 | }; |
| 14290 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14291 | /* Set Unsolicited Event*/ |
| 14292 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 14293 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14294 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14295 | {} |
| 14296 | }; |
| 14297 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14298 | /* |
| 14299 | * generic initialization of ADC, input mixers and output mixers |
| 14300 | */ |
| 14301 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 14302 | /* |
| 14303 | * Unmute ADC and set the default input to mic-in |
| 14304 | */ |
| 14305 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14306 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14307 | |
| 14308 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 14309 | * mixer widget |
| 14310 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 14311 | * panel mic (mic 2) |
| 14312 | */ |
| 14313 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14314 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14315 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14316 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14317 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14318 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14319 | |
| 14320 | /* |
| 14321 | * Set up output mixers (0x0c - 0x0f) |
| 14322 | */ |
| 14323 | /* set vol=0 to output mixers */ |
| 14324 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14325 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14326 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14327 | |
| 14328 | /* set up input amps for analog loopback */ |
| 14329 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14330 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14331 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14332 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14333 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14334 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14335 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14336 | |
| 14337 | |
| 14338 | /* FIXME: use matrix-type input source selection */ |
| 14339 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 14340 | /* Input mixer */ |
| 14341 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14342 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14343 | { } |
| 14344 | }; |
| 14345 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 14346 | /* additional verbs for ALC663 */ |
| 14347 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 14348 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14349 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14350 | { } |
| 14351 | }; |
| 14352 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14353 | static struct hda_verb alc663_m51va_init_verbs[] = { |
| 14354 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14355 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14356 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14357 | |
| 14358 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 14359 | |
| 14360 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14361 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14362 | {} |
| 14363 | }; |
| 14364 | |
| 14365 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 14366 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14367 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 14368 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 14369 | |
| 14370 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14371 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14372 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14373 | |
| 14374 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 14375 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 14376 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 14377 | {} |
| 14378 | }; |
| 14379 | |
| 14380 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 14381 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14382 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14383 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14384 | |
| 14385 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14386 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14387 | {} |
| 14388 | }; |
| 14389 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14390 | /* capture mixer elements */ |
| 14391 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 14392 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14393 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14394 | { |
| 14395 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14396 | /* The multiple "Capture Source" controls confuse alsamixer |
| 14397 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14398 | */ |
| 14399 | /* .name = "Capture Source", */ |
| 14400 | .name = "Input Source", |
| 14401 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 14402 | .info = alc662_mux_enum_info, |
| 14403 | .get = alc662_mux_enum_get, |
| 14404 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14405 | }, |
| 14406 | { } /* end */ |
| 14407 | }; |
| 14408 | |
| 14409 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 14410 | { |
| 14411 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14412 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14413 | |
| 14414 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 14415 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14416 | bits = present ? HDA_AMP_MUTE : 0; |
| 14417 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14418 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14419 | } |
| 14420 | |
| 14421 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 14422 | { |
| 14423 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14424 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14425 | |
| 14426 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14427 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14428 | bits = present ? HDA_AMP_MUTE : 0; |
| 14429 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14430 | HDA_AMP_MUTE, bits); |
| 14431 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14432 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14433 | } |
| 14434 | |
| 14435 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 14436 | unsigned int res) |
| 14437 | { |
| 14438 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14439 | alc662_lenovo_101e_all_automute(codec); |
| 14440 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 14441 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 14442 | } |
| 14443 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14444 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 14445 | { |
| 14446 | unsigned int present; |
| 14447 | |
| 14448 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14449 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 14450 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14451 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 14452 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14453 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 14454 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14455 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 14456 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14457 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 14458 | } |
| 14459 | |
| 14460 | /* unsolicited event for HP jack sensing */ |
| 14461 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 14462 | unsigned int res) |
| 14463 | { |
| 14464 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14465 | alc262_hippo1_automute( codec ); |
| 14466 | |
| 14467 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14468 | alc662_eeepc_mic_automute(codec); |
| 14469 | } |
| 14470 | |
| 14471 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 14472 | { |
| 14473 | alc262_hippo1_automute( codec ); |
| 14474 | alc662_eeepc_mic_automute(codec); |
| 14475 | } |
| 14476 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14477 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 14478 | { |
| 14479 | unsigned int mute; |
| 14480 | unsigned int present; |
| 14481 | |
| 14482 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 14483 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 14484 | AC_VERB_GET_PIN_SENSE, 0); |
| 14485 | present = (present & 0x80000000) != 0; |
| 14486 | if (present) { |
| 14487 | /* mute internal speaker */ |
| 14488 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14489 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14490 | } else { |
| 14491 | /* unmute internal speaker if necessary */ |
| 14492 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 14493 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14494 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14495 | } |
| 14496 | } |
| 14497 | |
| 14498 | /* unsolicited event for HP jack sensing */ |
| 14499 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 14500 | unsigned int res) |
| 14501 | { |
| 14502 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14503 | alc662_eeepc_ep20_automute(codec); |
| 14504 | } |
| 14505 | |
| 14506 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 14507 | { |
| 14508 | alc662_eeepc_ep20_automute(codec); |
| 14509 | } |
| 14510 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14511 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 14512 | { |
| 14513 | unsigned int present; |
| 14514 | unsigned char bits; |
| 14515 | |
| 14516 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 14517 | AC_VERB_GET_PIN_SENSE, 0) |
| 14518 | & AC_PINSENSE_PRESENCE; |
| 14519 | bits = present ? HDA_AMP_MUTE : 0; |
| 14520 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14521 | HDA_AMP_MUTE, bits); |
| 14522 | } |
| 14523 | |
| 14524 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 14525 | { |
| 14526 | unsigned int present; |
| 14527 | |
| 14528 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14529 | AC_VERB_GET_PIN_SENSE, 0) |
| 14530 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14531 | 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] | 14532 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14533 | 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] | 14534 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14535 | 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] | 14536 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14537 | 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] | 14538 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14539 | } |
| 14540 | |
| 14541 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 14542 | unsigned int res) |
| 14543 | { |
| 14544 | switch (res >> 26) { |
| 14545 | case ALC880_HP_EVENT: |
| 14546 | alc663_m51va_speaker_automute(codec); |
| 14547 | break; |
| 14548 | case ALC880_MIC_EVENT: |
| 14549 | alc663_m51va_mic_automute(codec); |
| 14550 | break; |
| 14551 | } |
| 14552 | } |
| 14553 | |
| 14554 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 14555 | { |
| 14556 | alc663_m51va_speaker_automute(codec); |
| 14557 | alc663_m51va_mic_automute(codec); |
| 14558 | } |
| 14559 | |
| 14560 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 14561 | { |
| 14562 | unsigned int present; |
| 14563 | unsigned char bits; |
| 14564 | |
| 14565 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 14566 | AC_VERB_GET_PIN_SENSE, 0) |
| 14567 | & AC_PINSENSE_PRESENCE; |
| 14568 | bits = present ? HDA_AMP_MUTE : 0; |
| 14569 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14570 | HDA_AMP_MUTE, bits); |
| 14571 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14572 | HDA_AMP_MUTE, bits); |
| 14573 | } |
| 14574 | |
| 14575 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 14576 | { |
| 14577 | unsigned int present; |
| 14578 | unsigned char bits; |
| 14579 | |
| 14580 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14581 | AC_VERB_GET_PIN_SENSE, 0) |
| 14582 | & AC_PINSENSE_PRESENCE; |
| 14583 | bits = present ? HDA_AMP_MUTE : 0; |
| 14584 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14585 | HDA_AMP_MUTE, bits); |
| 14586 | } |
| 14587 | |
| 14588 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 14589 | unsigned int res) |
| 14590 | { |
| 14591 | switch (res >> 26) { |
| 14592 | case ALC880_HP_EVENT: |
| 14593 | alc663_g71v_hp_automute(codec); |
| 14594 | break; |
| 14595 | case ALC880_FRONT_EVENT: |
| 14596 | alc663_g71v_front_automute(codec); |
| 14597 | break; |
| 14598 | case ALC880_MIC_EVENT: |
| 14599 | alc662_eeepc_mic_automute(codec); |
| 14600 | break; |
| 14601 | } |
| 14602 | } |
| 14603 | |
| 14604 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 14605 | { |
| 14606 | alc663_g71v_front_automute(codec); |
| 14607 | alc663_g71v_hp_automute(codec); |
| 14608 | alc662_eeepc_mic_automute(codec); |
| 14609 | } |
| 14610 | |
| 14611 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 14612 | unsigned int res) |
| 14613 | { |
| 14614 | switch (res >> 26) { |
| 14615 | case ALC880_HP_EVENT: |
| 14616 | alc663_m51va_speaker_automute(codec); |
| 14617 | break; |
| 14618 | case ALC880_MIC_EVENT: |
| 14619 | alc662_eeepc_mic_automute(codec); |
| 14620 | break; |
| 14621 | } |
| 14622 | } |
| 14623 | |
| 14624 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 14625 | { |
| 14626 | alc663_m51va_speaker_automute(codec); |
| 14627 | alc662_eeepc_mic_automute(codec); |
| 14628 | } |
| 14629 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14630 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14631 | #define alc662_loopbacks alc880_loopbacks |
| 14632 | #endif |
| 14633 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14634 | |
| 14635 | /* pcm configuration: identiacal with ALC880 */ |
| 14636 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 14637 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 14638 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 14639 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 14640 | |
| 14641 | /* |
| 14642 | * configuration and preset |
| 14643 | */ |
| 14644 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 14645 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 14646 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 14647 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 14648 | [ALC662_5ST_DIG] = "6stack-dig", |
| 14649 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 14650 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14651 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14652 | [ALC663_ASUS_M51VA] = "m51va", |
| 14653 | [ALC663_ASUS_G71V] = "g71v", |
| 14654 | [ALC663_ASUS_H13] = "h13", |
| 14655 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14656 | [ALC662_AUTO] = "auto", |
| 14657 | }; |
| 14658 | |
| 14659 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14660 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V), |
| 14661 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
| 14662 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 14663 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14664 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14665 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14666 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14667 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
| 14668 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
| 14669 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14670 | {} |
| 14671 | }; |
| 14672 | |
| 14673 | static struct alc_config_preset alc662_presets[] = { |
| 14674 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14675 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14676 | .init_verbs = { alc662_init_verbs }, |
| 14677 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14678 | .dac_nids = alc662_dac_nids, |
| 14679 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14680 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14681 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14682 | .channel_mode = alc662_3ST_2ch_modes, |
| 14683 | .input_mux = &alc662_capture_source, |
| 14684 | }, |
| 14685 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14686 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 14687 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14688 | .init_verbs = { alc662_init_verbs }, |
| 14689 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14690 | .dac_nids = alc662_dac_nids, |
| 14691 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14692 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14693 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14694 | .channel_mode = alc662_3ST_6ch_modes, |
| 14695 | .need_dac_fix = 1, |
| 14696 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14697 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14698 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14699 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 14700 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14701 | .init_verbs = { alc662_init_verbs }, |
| 14702 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14703 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14704 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14705 | .channel_mode = alc662_3ST_6ch_modes, |
| 14706 | .need_dac_fix = 1, |
| 14707 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14708 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14709 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14710 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 14711 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14712 | .init_verbs = { alc662_init_verbs }, |
| 14713 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14714 | .dac_nids = alc662_dac_nids, |
| 14715 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14716 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14717 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 14718 | .channel_mode = alc662_5stack_modes, |
| 14719 | .input_mux = &alc662_capture_source, |
| 14720 | }, |
| 14721 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14722 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14723 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 14724 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14725 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14726 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14727 | .channel_mode = alc662_3ST_2ch_modes, |
| 14728 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 14729 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 14730 | .init_hook = alc662_lenovo_101e_all_automute, |
| 14731 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14732 | [ALC662_ASUS_EEEPC_P701] = { |
| 14733 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 14734 | .init_verbs = { alc662_init_verbs, |
| 14735 | alc662_eeepc_sue_init_verbs }, |
| 14736 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14737 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14738 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14739 | .channel_mode = alc662_3ST_2ch_modes, |
| 14740 | .input_mux = &alc662_eeepc_capture_source, |
| 14741 | .unsol_event = alc662_eeepc_unsol_event, |
| 14742 | .init_hook = alc662_eeepc_inithook, |
| 14743 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14744 | [ALC662_ASUS_EEEPC_EP20] = { |
| 14745 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 14746 | alc662_chmode_mixer }, |
| 14747 | .init_verbs = { alc662_init_verbs, |
| 14748 | alc662_eeepc_ep20_sue_init_verbs }, |
| 14749 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14750 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14751 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14752 | .channel_mode = alc662_3ST_6ch_modes, |
| 14753 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 14754 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 14755 | .init_hook = alc662_eeepc_ep20_inithook, |
| 14756 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14757 | [ALC663_ASUS_M51VA] = { |
| 14758 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 14759 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 14760 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14761 | .dac_nids = alc662_dac_nids, |
| 14762 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14763 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14764 | .channel_mode = alc662_3ST_2ch_modes, |
| 14765 | .input_mux = &alc663_m51va_capture_source, |
| 14766 | .unsol_event = alc663_m51va_unsol_event, |
| 14767 | .init_hook = alc663_m51va_inithook, |
| 14768 | }, |
| 14769 | [ALC663_ASUS_G71V] = { |
| 14770 | .mixers = { alc663_g71v_mixer, alc662_capture_mixer}, |
| 14771 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 14772 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14773 | .dac_nids = alc662_dac_nids, |
| 14774 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14775 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14776 | .channel_mode = alc662_3ST_2ch_modes, |
| 14777 | .input_mux = &alc662_eeepc_capture_source, |
| 14778 | .unsol_event = alc663_g71v_unsol_event, |
| 14779 | .init_hook = alc663_g71v_inithook, |
| 14780 | }, |
| 14781 | [ALC663_ASUS_H13] = { |
| 14782 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 14783 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 14784 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14785 | .dac_nids = alc662_dac_nids, |
| 14786 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14787 | .channel_mode = alc662_3ST_2ch_modes, |
| 14788 | .input_mux = &alc663_m51va_capture_source, |
| 14789 | .unsol_event = alc663_m51va_unsol_event, |
| 14790 | .init_hook = alc663_m51va_inithook, |
| 14791 | }, |
| 14792 | [ALC663_ASUS_G50V] = { |
| 14793 | .mixers = { alc663_g50v_mixer, alc662_capture_mixer}, |
| 14794 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 14795 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14796 | .dac_nids = alc662_dac_nids, |
| 14797 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14798 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14799 | .channel_mode = alc662_3ST_6ch_modes, |
| 14800 | .input_mux = &alc663_capture_source, |
| 14801 | .unsol_event = alc663_g50v_unsol_event, |
| 14802 | .init_hook = alc663_g50v_inithook, |
| 14803 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14804 | }; |
| 14805 | |
| 14806 | |
| 14807 | /* |
| 14808 | * BIOS auto configuration |
| 14809 | */ |
| 14810 | |
| 14811 | /* add playback controls from the parsed DAC table */ |
| 14812 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14813 | const struct auto_pin_cfg *cfg) |
| 14814 | { |
| 14815 | char name[32]; |
| 14816 | static const char *chname[4] = { |
| 14817 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14818 | }; |
| 14819 | hda_nid_t nid; |
| 14820 | int i, err; |
| 14821 | |
| 14822 | for (i = 0; i < cfg->line_outs; i++) { |
| 14823 | if (!spec->multiout.dac_nids[i]) |
| 14824 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14825 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14826 | if (i == 2) { |
| 14827 | /* Center/LFE */ |
| 14828 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14829 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14830 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 14831 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14832 | if (err < 0) |
| 14833 | return err; |
| 14834 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14835 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14836 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 14837 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14838 | if (err < 0) |
| 14839 | return err; |
| 14840 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14841 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14842 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 14843 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14844 | if (err < 0) |
| 14845 | return err; |
| 14846 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14847 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14848 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 14849 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14850 | if (err < 0) |
| 14851 | return err; |
| 14852 | } else { |
| 14853 | sprintf(name, "%s Playback Volume", chname[i]); |
| 14854 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14855 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 14856 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14857 | if (err < 0) |
| 14858 | return err; |
| 14859 | sprintf(name, "%s Playback Switch", chname[i]); |
| 14860 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14861 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 14862 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14863 | if (err < 0) |
| 14864 | return err; |
| 14865 | } |
| 14866 | } |
| 14867 | return 0; |
| 14868 | } |
| 14869 | |
| 14870 | /* add playback controls for speaker and HP outputs */ |
| 14871 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 14872 | const char *pfx) |
| 14873 | { |
| 14874 | hda_nid_t nid; |
| 14875 | int err; |
| 14876 | char name[32]; |
| 14877 | |
| 14878 | if (!pin) |
| 14879 | return 0; |
| 14880 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 14881 | if (pin == 0x17) { |
| 14882 | /* ALC663 has a mono output pin on 0x17 */ |
| 14883 | sprintf(name, "%s Playback Switch", pfx); |
| 14884 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14885 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 14886 | return err; |
| 14887 | } |
| 14888 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14889 | if (alc880_is_fixed_pin(pin)) { |
| 14890 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14891 | /* printk("DAC nid=%x\n",nid); */ |
| 14892 | /* specify the DAC as the extra output */ |
| 14893 | if (!spec->multiout.hp_nid) |
| 14894 | spec->multiout.hp_nid = nid; |
| 14895 | else |
| 14896 | spec->multiout.extra_out_nid[0] = nid; |
| 14897 | /* control HP volume/switch on the output mixer amp */ |
| 14898 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14899 | sprintf(name, "%s Playback Volume", pfx); |
| 14900 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14901 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 14902 | if (err < 0) |
| 14903 | return err; |
| 14904 | sprintf(name, "%s Playback Switch", pfx); |
| 14905 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14906 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 14907 | if (err < 0) |
| 14908 | return err; |
| 14909 | } else if (alc880_is_multi_pin(pin)) { |
| 14910 | /* set manual connection */ |
| 14911 | /* we have only a switch on HP-out PIN */ |
| 14912 | sprintf(name, "%s Playback Switch", pfx); |
| 14913 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14914 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14915 | if (err < 0) |
| 14916 | return err; |
| 14917 | } |
| 14918 | return 0; |
| 14919 | } |
| 14920 | |
| 14921 | /* create playback/capture controls for input pins */ |
| 14922 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 14923 | const struct auto_pin_cfg *cfg) |
| 14924 | { |
| 14925 | struct hda_input_mux *imux = &spec->private_imux; |
| 14926 | int i, err, idx; |
| 14927 | |
| 14928 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14929 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 14930 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 14931 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14932 | auto_pin_cfg_labels[i], |
| 14933 | idx, 0x0b); |
| 14934 | if (err < 0) |
| 14935 | return err; |
| 14936 | imux->items[imux->num_items].label = |
| 14937 | auto_pin_cfg_labels[i]; |
| 14938 | imux->items[imux->num_items].index = |
| 14939 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 14940 | imux->num_items++; |
| 14941 | } |
| 14942 | } |
| 14943 | return 0; |
| 14944 | } |
| 14945 | |
| 14946 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14947 | hda_nid_t nid, int pin_type, |
| 14948 | int dac_idx) |
| 14949 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14950 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14951 | /* need the manual connection? */ |
| 14952 | if (alc880_is_multi_pin(nid)) { |
| 14953 | struct alc_spec *spec = codec->spec; |
| 14954 | int idx = alc880_multi_pin_idx(nid); |
| 14955 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 14956 | AC_VERB_SET_CONNECT_SEL, |
| 14957 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 14958 | } |
| 14959 | } |
| 14960 | |
| 14961 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 14962 | { |
| 14963 | struct alc_spec *spec = codec->spec; |
| 14964 | int i; |
| 14965 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14966 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14967 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14968 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14969 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14970 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14971 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14972 | i); |
| 14973 | } |
| 14974 | } |
| 14975 | |
| 14976 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 14977 | { |
| 14978 | struct alc_spec *spec = codec->spec; |
| 14979 | hda_nid_t pin; |
| 14980 | |
| 14981 | pin = spec->autocfg.hp_pins[0]; |
| 14982 | if (pin) /* connect to front */ |
| 14983 | /* use dac 0 */ |
| 14984 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14985 | pin = spec->autocfg.speaker_pins[0]; |
| 14986 | if (pin) |
| 14987 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14988 | } |
| 14989 | |
| 14990 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14991 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 14992 | |
| 14993 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 14994 | { |
| 14995 | struct alc_spec *spec = codec->spec; |
| 14996 | int i; |
| 14997 | |
| 14998 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14999 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15000 | if (alc662_is_input_pin(nid)) { |
| 15001 | snd_hda_codec_write(codec, nid, 0, |
| 15002 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15003 | (i <= AUTO_PIN_FRONT_MIC ? |
| 15004 | PIN_VREF80 : PIN_IN)); |
| 15005 | if (nid != ALC662_PIN_CD_NID) |
| 15006 | snd_hda_codec_write(codec, nid, 0, |
| 15007 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15008 | AMP_OUT_MUTE); |
| 15009 | } |
| 15010 | } |
| 15011 | } |
| 15012 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15013 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 15014 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15015 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 15016 | { |
| 15017 | struct alc_spec *spec = codec->spec; |
| 15018 | int err; |
| 15019 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 15020 | |
| 15021 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15022 | alc662_ignore); |
| 15023 | if (err < 0) |
| 15024 | return err; |
| 15025 | if (!spec->autocfg.line_outs) |
| 15026 | return 0; /* can't find valid BIOS pin config */ |
| 15027 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15028 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15029 | if (err < 0) |
| 15030 | return err; |
| 15031 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15032 | if (err < 0) |
| 15033 | return err; |
| 15034 | err = alc662_auto_create_extra_out(spec, |
| 15035 | spec->autocfg.speaker_pins[0], |
| 15036 | "Speaker"); |
| 15037 | if (err < 0) |
| 15038 | return err; |
| 15039 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 15040 | "Headphone"); |
| 15041 | if (err < 0) |
| 15042 | return err; |
| 15043 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15044 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15045 | return err; |
| 15046 | |
| 15047 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15048 | |
| 15049 | if (spec->autocfg.dig_out_pin) |
| 15050 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 15051 | |
| 15052 | if (spec->kctl_alloc) |
| 15053 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 15054 | |
| 15055 | spec->num_mux_defs = 1; |
| 15056 | spec->input_mux = &spec->private_imux; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15057 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 15058 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15059 | if (codec->vendor_id == 0x10ec0663) |
| 15060 | spec->init_verbs[spec->num_init_verbs++] = |
| 15061 | alc663_auto_init_verbs; |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 15062 | |
| 15063 | err = alc_auto_add_mic_boost(codec); |
| 15064 | if (err < 0) |
| 15065 | return err; |
| 15066 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15067 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 15068 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 15069 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15070 | } |
| 15071 | |
| 15072 | /* additional initialization for auto-configuration model */ |
| 15073 | static void alc662_auto_init(struct hda_codec *codec) |
| 15074 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15075 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15076 | alc662_auto_init_multi_out(codec); |
| 15077 | alc662_auto_init_hp_out(codec); |
| 15078 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15079 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15080 | if (spec->unsol_event) |
| 15081 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15082 | } |
| 15083 | |
| 15084 | static int patch_alc662(struct hda_codec *codec) |
| 15085 | { |
| 15086 | struct alc_spec *spec; |
| 15087 | int err, board_config; |
| 15088 | |
| 15089 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15090 | if (!spec) |
| 15091 | return -ENOMEM; |
| 15092 | |
| 15093 | codec->spec = spec; |
| 15094 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 15095 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15096 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15097 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 15098 | alc662_models, |
| 15099 | alc662_cfg_tbl); |
| 15100 | if (board_config < 0) { |
| 15101 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 15102 | "trying auto-probe from BIOS...\n"); |
| 15103 | board_config = ALC662_AUTO; |
| 15104 | } |
| 15105 | |
| 15106 | if (board_config == ALC662_AUTO) { |
| 15107 | /* automatic parse from the BIOS config */ |
| 15108 | err = alc662_parse_auto_config(codec); |
| 15109 | if (err < 0) { |
| 15110 | alc_free(codec); |
| 15111 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 15112 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15113 | printk(KERN_INFO |
| 15114 | "hda_codec: Cannot set up configuration " |
| 15115 | "from BIOS. Using base mode...\n"); |
| 15116 | board_config = ALC662_3ST_2ch_DIG; |
| 15117 | } |
| 15118 | } |
| 15119 | |
| 15120 | if (board_config != ALC662_AUTO) |
| 15121 | setup_preset(spec, &alc662_presets[board_config]); |
| 15122 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15123 | if (codec->vendor_id == 0x10ec0663) { |
| 15124 | spec->stream_name_analog = "ALC663 Analog"; |
| 15125 | spec->stream_name_digital = "ALC663 Digital"; |
| 15126 | } else { |
| 15127 | spec->stream_name_analog = "ALC662 Analog"; |
| 15128 | spec->stream_name_digital = "ALC662 Digital"; |
| 15129 | } |
| 15130 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15131 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 15132 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 15133 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15134 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 15135 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 15136 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15137 | spec->adc_nids = alc662_adc_nids; |
| 15138 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 15139 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15140 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15141 | spec->vmaster_nid = 0x02; |
| 15142 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15143 | codec->patch_ops = alc_patch_ops; |
| 15144 | if (board_config == ALC662_AUTO) |
| 15145 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15146 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15147 | if (!spec->loopback.amplist) |
| 15148 | spec->loopback.amplist = alc662_loopbacks; |
| 15149 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15150 | |
| 15151 | return 0; |
| 15152 | } |
| 15153 | |
| 15154 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15155 | * patch entries |
| 15156 | */ |
| 15157 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 15158 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15159 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15160 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 15161 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15162 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15163 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15164 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15165 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 15166 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 15167 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15168 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 15169 | .patch = patch_alc883 }, |
| 15170 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 15171 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15172 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15173 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15174 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15175 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 15176 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 15177 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15178 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15179 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15180 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15181 | {} /* terminator */ |
| 15182 | }; |