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, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_RX1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 107 | ALC262_AUTO, |
| 108 | ALC262_MODEL_LAST /* last tag */ |
| 109 | }; |
| 110 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 111 | /* ALC268 models */ |
| 112 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 113 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 115 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 116 | ALC268_ACER, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 117 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 118 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 119 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 120 | #ifdef CONFIG_SND_DEBUG |
| 121 | ALC268_TEST, |
| 122 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 123 | ALC268_AUTO, |
| 124 | ALC268_MODEL_LAST /* last tag */ |
| 125 | }; |
| 126 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 127 | /* ALC269 models */ |
| 128 | enum { |
| 129 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 130 | ALC269_QUANTA_FL1, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 131 | ALC269_ASUS_EEEPC_P703, |
| 132 | ALC269_ASUS_EEEPC_P901, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 133 | ALC269_AUTO, |
| 134 | ALC269_MODEL_LAST /* last tag */ |
| 135 | }; |
| 136 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 137 | /* ALC861 models */ |
| 138 | enum { |
| 139 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 140 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 141 | ALC861_3ST_DIG, |
| 142 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 143 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 144 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 145 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 146 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 147 | ALC861_AUTO, |
| 148 | ALC861_MODEL_LAST, |
| 149 | }; |
| 150 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 151 | /* ALC861-VD models */ |
| 152 | enum { |
| 153 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 154 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 155 | ALC861VD_3ST, |
| 156 | ALC861VD_3ST_DIG, |
| 157 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 158 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 159 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 160 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 161 | ALC861VD_AUTO, |
| 162 | ALC861VD_MODEL_LAST, |
| 163 | }; |
| 164 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 165 | /* ALC662 models */ |
| 166 | enum { |
| 167 | ALC662_3ST_2ch_DIG, |
| 168 | ALC662_3ST_6ch_DIG, |
| 169 | ALC662_3ST_6ch, |
| 170 | ALC662_5ST_DIG, |
| 171 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 172 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 173 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 174 | ALC663_ASUS_M51VA, |
| 175 | ALC663_ASUS_G71V, |
| 176 | ALC663_ASUS_H13, |
| 177 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 178 | ALC662_ECS, |
| 179 | ALC663_ASUS_MODE1, |
| 180 | ALC662_ASUS_MODE2, |
| 181 | ALC663_ASUS_MODE3, |
| 182 | ALC663_ASUS_MODE4, |
| 183 | ALC663_ASUS_MODE5, |
| 184 | ALC663_ASUS_MODE6, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 185 | ALC662_AUTO, |
| 186 | ALC662_MODEL_LAST, |
| 187 | }; |
| 188 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 189 | /* ALC882 models */ |
| 190 | enum { |
| 191 | ALC882_3ST_DIG, |
| 192 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 193 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 194 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 195 | ALC882_TARGA, |
| 196 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 197 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 198 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 199 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 200 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 201 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 202 | ALC882_MODEL_LAST, |
| 203 | }; |
| 204 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 205 | /* ALC883 models */ |
| 206 | enum { |
| 207 | ALC883_3ST_2ch_DIG, |
| 208 | ALC883_3ST_6ch_DIG, |
| 209 | ALC883_3ST_6ch, |
| 210 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 211 | ALC883_TARGA_DIG, |
| 212 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 213 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 214 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 215 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 216 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 217 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 218 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 219 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 220 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 221 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 222 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 223 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 224 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 225 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 226 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 227 | ALC883_FUJITSU_PI2515, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 228 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 229 | ALC888_ASUS_M90V, |
| 230 | ALC888_ASUS_EEE1601, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 231 | ALC883_AUTO, |
| 232 | ALC883_MODEL_LAST, |
| 233 | }; |
| 234 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 235 | /* for GPIO Poll */ |
| 236 | #define GPIO_MASK 0x03 |
| 237 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | struct alc_spec { |
| 239 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 240 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | unsigned int num_mixers; |
| 242 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 243 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 244 | * don't forget NULL |
| 245 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 246 | */ |
| 247 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 249 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | struct hda_pcm_stream *stream_analog_playback; |
| 251 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 252 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 253 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 255 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | struct hda_pcm_stream *stream_digital_playback; |
| 257 | struct hda_pcm_stream *stream_digital_capture; |
| 258 | |
| 259 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 260 | struct hda_multi_out multiout; /* playback set-up |
| 261 | * max_channels, dacs must be set |
| 262 | * dig_out_nid and hp_nid are optional |
| 263 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 264 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | |
| 266 | /* capture */ |
| 267 | unsigned int num_adc_nids; |
| 268 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 269 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 270 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | |
| 272 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 273 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | const struct hda_input_mux *input_mux; |
| 275 | unsigned int cur_mux[3]; |
| 276 | |
| 277 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 278 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 280 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | |
| 282 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 283 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 284 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 285 | /* dynamic controls, init_verbs and input_mux */ |
| 286 | struct auto_pin_cfg autocfg; |
| 287 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 288 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 289 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 290 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 291 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 292 | /* hooks */ |
| 293 | void (*init_hook)(struct hda_codec *codec); |
| 294 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 295 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 296 | /* for pin sensing */ |
| 297 | unsigned int sense_updated: 1; |
| 298 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 299 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 300 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 301 | /* for virtual master */ |
| 302 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 303 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 304 | struct hda_loopback_check loopback; |
| 305 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 306 | |
| 307 | /* for PLL fix */ |
| 308 | hda_nid_t pll_nid; |
| 309 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 310 | }; |
| 311 | |
| 312 | /* |
| 313 | * configuration template - to be copied to the spec instance |
| 314 | */ |
| 315 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 316 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 317 | * with spec |
| 318 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 319 | const struct hda_verb *init_verbs[5]; |
| 320 | unsigned int num_dacs; |
| 321 | hda_nid_t *dac_nids; |
| 322 | hda_nid_t dig_out_nid; /* optional */ |
| 323 | hda_nid_t hp_nid; /* optional */ |
| 324 | unsigned int num_adc_nids; |
| 325 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 326 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 327 | hda_nid_t dig_in_nid; |
| 328 | unsigned int num_channel_mode; |
| 329 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 330 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 331 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 332 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 333 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 334 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 335 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 336 | struct hda_amp_list *loopbacks; |
| 337 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | }; |
| 339 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | |
| 341 | /* |
| 342 | * input MUX handling |
| 343 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 344 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 345 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | { |
| 347 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 348 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 349 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 350 | if (mux_idx >= spec->num_mux_defs) |
| 351 | mux_idx = 0; |
| 352 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | } |
| 354 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 355 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 356 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | { |
| 358 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 359 | struct alc_spec *spec = codec->spec; |
| 360 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 361 | |
| 362 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 363 | return 0; |
| 364 | } |
| 365 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 366 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 367 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | { |
| 369 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 370 | struct alc_spec *spec = codec->spec; |
| 371 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 372 | 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] | 373 | hda_nid_t nid = spec->capsrc_nids ? |
| 374 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 375 | 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] | 376 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | } |
| 378 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 379 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | /* |
| 381 | * channel mode setting |
| 382 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 383 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 384 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | { |
| 386 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 387 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 388 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 389 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | } |
| 391 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 392 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 393 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | { |
| 395 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 396 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 397 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 398 | spec->num_channel_mode, |
| 399 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | } |
| 401 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 402 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 403 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | { |
| 405 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 406 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 407 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 408 | spec->num_channel_mode, |
| 409 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 410 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 411 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 412 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | } |
| 414 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 416 | * 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] | 417 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 418 | * being part of a format specifier. Maximum allowed length of a value is |
| 419 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 420 | * |
| 421 | * Note: some retasking pin complexes seem to ignore requests for input |
| 422 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 423 | * are requested. Therefore order this list so that this behaviour will not |
| 424 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 425 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 426 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 427 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 428 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 429 | "Mic 50pc bias", "Mic 80pc bias", |
| 430 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 431 | }; |
| 432 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 433 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 434 | }; |
| 435 | /* 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] | 436 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 437 | * addition, "input" pins may or may not process the mic bias option |
| 438 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 439 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 440 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 441 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 442 | #define ALC_PIN_DIR_IN 0x00 |
| 443 | #define ALC_PIN_DIR_OUT 0x01 |
| 444 | #define ALC_PIN_DIR_INOUT 0x02 |
| 445 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 446 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 447 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 448 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 449 | * For each direction the minimum and maximum values are given. |
| 450 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 451 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 452 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 453 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 454 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 455 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 456 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 457 | }; |
| 458 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 459 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 460 | #define alc_pin_mode_n_items(_dir) \ |
| 461 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 462 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 463 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 464 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 465 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 466 | unsigned int item_num = uinfo->value.enumerated.item; |
| 467 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 468 | |
| 469 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 470 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 471 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 472 | |
| 473 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 474 | item_num = alc_pin_mode_min(dir); |
| 475 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 476 | return 0; |
| 477 | } |
| 478 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 479 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 480 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 481 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 482 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 483 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 484 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 485 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 486 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 487 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 488 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 489 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 490 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 491 | /* Find enumerated value for current pinctl setting */ |
| 492 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 493 | 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] | 494 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 495 | *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] | 496 | return 0; |
| 497 | } |
| 498 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 499 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 500 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 501 | { |
| 502 | signed int change; |
| 503 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 504 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 505 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 506 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 507 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 508 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 509 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 510 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 511 | 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] | 512 | val = alc_pin_mode_min(dir); |
| 513 | |
| 514 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 515 | if (change) { |
| 516 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 517 | snd_hda_codec_write_cache(codec, nid, 0, |
| 518 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 519 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 520 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 521 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 522 | * for the requested pin mode. Enum values of 2 or less are |
| 523 | * input modes. |
| 524 | * |
| 525 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 526 | * reduces noise slightly (particularly on input) so we'll |
| 527 | * do it. However, having both input and output buffers |
| 528 | * enabled simultaneously doesn't seem to be problematic if |
| 529 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 530 | */ |
| 531 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 532 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 533 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 534 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 535 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 536 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 537 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 538 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 539 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 540 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 541 | } |
| 542 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 543 | return change; |
| 544 | } |
| 545 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 546 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 547 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 548 | .info = alc_pin_mode_info, \ |
| 549 | .get = alc_pin_mode_get, \ |
| 550 | .put = alc_pin_mode_put, \ |
| 551 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 552 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 553 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 554 | * together using a mask with more than one bit set. This control is |
| 555 | * currently used only by the ALC260 test model. At this stage they are not |
| 556 | * needed for any "production" models. |
| 557 | */ |
| 558 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 559 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 560 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 561 | static int alc_gpio_data_get(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 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 565 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 566 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 567 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 568 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 569 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 570 | |
| 571 | *valp = (val & mask) != 0; |
| 572 | return 0; |
| 573 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 574 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 575 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 576 | { |
| 577 | signed int change; |
| 578 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 579 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 580 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 581 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 582 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 583 | AC_VERB_GET_GPIO_DATA, |
| 584 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 585 | |
| 586 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 587 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 588 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 589 | gpio_data &= ~mask; |
| 590 | else |
| 591 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 592 | snd_hda_codec_write_cache(codec, nid, 0, |
| 593 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 594 | |
| 595 | return change; |
| 596 | } |
| 597 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 598 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 599 | .info = alc_gpio_data_info, \ |
| 600 | .get = alc_gpio_data_get, \ |
| 601 | .put = alc_gpio_data_put, \ |
| 602 | .private_value = nid | (mask<<16) } |
| 603 | #endif /* CONFIG_SND_DEBUG */ |
| 604 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 605 | /* A switch control to allow the enabling of the digital IO pins on the |
| 606 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 607 | * to provide something in the test model allowing digital outputs to be |
| 608 | * identified if present. If models are found which can utilise these |
| 609 | * outputs a more complete mixer control can be devised for those models if |
| 610 | * necessary. |
| 611 | */ |
| 612 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 613 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 614 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 615 | static int alc_spdif_ctrl_get(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 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 619 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 620 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 621 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 622 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 623 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 624 | |
| 625 | *valp = (val & mask) != 0; |
| 626 | return 0; |
| 627 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 628 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 629 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 630 | { |
| 631 | signed int change; |
| 632 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 633 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 634 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 635 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 636 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 637 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 638 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 639 | |
| 640 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 641 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 642 | if (val==0) |
| 643 | ctrl_data &= ~mask; |
| 644 | else |
| 645 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 646 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 647 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 648 | |
| 649 | return change; |
| 650 | } |
| 651 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 652 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 653 | .info = alc_spdif_ctrl_info, \ |
| 654 | .get = alc_spdif_ctrl_get, \ |
| 655 | .put = alc_spdif_ctrl_put, \ |
| 656 | .private_value = nid | (mask<<16) } |
| 657 | #endif /* CONFIG_SND_DEBUG */ |
| 658 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 659 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 660 | * Again, this is only used in the ALC26x test models to help identify when |
| 661 | * the EAPD line must be asserted for features to work. |
| 662 | */ |
| 663 | #ifdef CONFIG_SND_DEBUG |
| 664 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 665 | |
| 666 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 667 | struct snd_ctl_elem_value *ucontrol) |
| 668 | { |
| 669 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 670 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 671 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 672 | long *valp = ucontrol->value.integer.value; |
| 673 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 674 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 675 | |
| 676 | *valp = (val & mask) != 0; |
| 677 | return 0; |
| 678 | } |
| 679 | |
| 680 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 681 | struct snd_ctl_elem_value *ucontrol) |
| 682 | { |
| 683 | int change; |
| 684 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 685 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 686 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 687 | long val = *ucontrol->value.integer.value; |
| 688 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 689 | AC_VERB_GET_EAPD_BTLENABLE, |
| 690 | 0x00); |
| 691 | |
| 692 | /* Set/unset the masked control bit(s) as needed */ |
| 693 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 694 | if (!val) |
| 695 | ctrl_data &= ~mask; |
| 696 | else |
| 697 | ctrl_data |= mask; |
| 698 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 699 | ctrl_data); |
| 700 | |
| 701 | return change; |
| 702 | } |
| 703 | |
| 704 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 705 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 706 | .info = alc_eapd_ctrl_info, \ |
| 707 | .get = alc_eapd_ctrl_get, \ |
| 708 | .put = alc_eapd_ctrl_put, \ |
| 709 | .private_value = nid | (mask<<16) } |
| 710 | #endif /* CONFIG_SND_DEBUG */ |
| 711 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 712 | /* |
| 713 | * set up from the preset table |
| 714 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 715 | static void setup_preset(struct alc_spec *spec, |
| 716 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 717 | { |
| 718 | int i; |
| 719 | |
| 720 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 721 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 722 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 723 | i++) |
| 724 | spec->init_verbs[spec->num_init_verbs++] = |
| 725 | preset->init_verbs[i]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 726 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 727 | spec->channel_mode = preset->channel_mode; |
| 728 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 729 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 730 | |
| 731 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 732 | |
| 733 | spec->multiout.num_dacs = preset->num_dacs; |
| 734 | spec->multiout.dac_nids = preset->dac_nids; |
| 735 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 736 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 737 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 738 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 739 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 740 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 741 | spec->input_mux = preset->input_mux; |
| 742 | |
| 743 | spec->num_adc_nids = preset->num_adc_nids; |
| 744 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 745 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 746 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 747 | |
| 748 | spec->unsol_event = preset->unsol_event; |
| 749 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 750 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 751 | spec->loopback.amplist = preset->loopbacks; |
| 752 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 753 | } |
| 754 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 755 | /* Enable GPIO mask and set output */ |
| 756 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 757 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 758 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 759 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 760 | { } |
| 761 | }; |
| 762 | |
| 763 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 764 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 765 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 766 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 767 | { } |
| 768 | }; |
| 769 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 770 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 771 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 772 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 773 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 774 | { } |
| 775 | }; |
| 776 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 777 | /* |
| 778 | * Fix hardware PLL issue |
| 779 | * On some codecs, the analog PLL gating control must be off while |
| 780 | * the default value is 1. |
| 781 | */ |
| 782 | static void alc_fix_pll(struct hda_codec *codec) |
| 783 | { |
| 784 | struct alc_spec *spec = codec->spec; |
| 785 | unsigned int val; |
| 786 | |
| 787 | if (!spec->pll_nid) |
| 788 | return; |
| 789 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 790 | spec->pll_coef_idx); |
| 791 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 792 | AC_VERB_GET_PROC_COEF, 0); |
| 793 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 794 | spec->pll_coef_idx); |
| 795 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 796 | val & ~(1 << spec->pll_coef_bit)); |
| 797 | } |
| 798 | |
| 799 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 800 | unsigned int coef_idx, unsigned int coef_bit) |
| 801 | { |
| 802 | struct alc_spec *spec = codec->spec; |
| 803 | spec->pll_nid = nid; |
| 804 | spec->pll_coef_idx = coef_idx; |
| 805 | spec->pll_coef_bit = coef_bit; |
| 806 | alc_fix_pll(codec); |
| 807 | } |
| 808 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 809 | static void alc_sku_automute(struct hda_codec *codec) |
| 810 | { |
| 811 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 812 | unsigned int present; |
| 813 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 814 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 815 | |
| 816 | /* need to execute and sync at first */ |
| 817 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 818 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 819 | AC_VERB_GET_PIN_SENSE, 0); |
| 820 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 821 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 822 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 823 | } |
| 824 | |
| 825 | /* unsolicited event for HP jack sensing */ |
| 826 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 827 | { |
| 828 | if (codec->vendor_id == 0x10ec0880) |
| 829 | res >>= 28; |
| 830 | else |
| 831 | res >>= 26; |
| 832 | if (res != ALC880_HP_EVENT) |
| 833 | return; |
| 834 | |
| 835 | alc_sku_automute(codec); |
| 836 | } |
| 837 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 838 | /* additional initialization for ALC888 variants */ |
| 839 | static void alc888_coef_init(struct hda_codec *codec) |
| 840 | { |
| 841 | unsigned int tmp; |
| 842 | |
| 843 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 844 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 845 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 846 | if ((tmp & 0xf0) == 2) |
| 847 | /* alc888S-VC */ |
| 848 | snd_hda_codec_read(codec, 0x20, 0, |
| 849 | AC_VERB_SET_PROC_COEF, 0x830); |
| 850 | else |
| 851 | /* alc888-VB */ |
| 852 | snd_hda_codec_read(codec, 0x20, 0, |
| 853 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 854 | } |
| 855 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 856 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 857 | * 31 ~ 16 : Manufacture ID |
| 858 | * 15 ~ 8 : SKU ID |
| 859 | * 7 ~ 0 : Assembly ID |
| 860 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 861 | */ |
| 862 | static void alc_subsystem_id(struct hda_codec *codec, |
| 863 | unsigned int porta, unsigned int porte, |
| 864 | unsigned int portd) |
| 865 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 866 | unsigned int ass, tmp, i; |
| 867 | unsigned nid; |
| 868 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 869 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 870 | ass = codec->subsystem_id & 0xffff; |
| 871 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 872 | goto do_sku; |
| 873 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 874 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 875 | * 31~30 : port conetcivity |
| 876 | * 29~21 : reserve |
| 877 | * 20 : PCBEEP input |
| 878 | * 19~16 : Check sum (15:1) |
| 879 | * 15~1 : Custom |
| 880 | * 0 : override |
| 881 | */ |
| 882 | nid = 0x1d; |
| 883 | if (codec->vendor_id == 0x10ec0260) |
| 884 | nid = 0x17; |
| 885 | ass = snd_hda_codec_read(codec, nid, 0, |
| 886 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 887 | if (!(ass & 1) && !(ass & 0x100000)) |
| 888 | return; |
| 889 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 890 | return; |
| 891 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 892 | /* check sum */ |
| 893 | tmp = 0; |
| 894 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 895 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 896 | tmp++; |
| 897 | } |
| 898 | if (((ass >> 16) & 0xf) != tmp) |
| 899 | return; |
| 900 | do_sku: |
| 901 | /* |
| 902 | * 0 : override |
| 903 | * 1 : Swap Jack |
| 904 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 905 | * 3~5 : External Amplifier control |
| 906 | * 7~6 : Reserved |
| 907 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 908 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 909 | switch (tmp) { |
| 910 | case 1: |
| 911 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 912 | break; |
| 913 | case 3: |
| 914 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 915 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 916 | case 7: |
| 917 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 918 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 919 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 920 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 921 | case 0x10ec0260: |
| 922 | snd_hda_codec_write(codec, 0x0f, 0, |
| 923 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 924 | snd_hda_codec_write(codec, 0x10, 0, |
| 925 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 926 | break; |
| 927 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 928 | case 0x10ec0267: |
| 929 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 930 | case 0x10ec0269: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 931 | case 0x10ec0660: |
| 932 | case 0x10ec0662: |
| 933 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 934 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 935 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 936 | snd_hda_codec_write(codec, 0x14, 0, |
| 937 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 938 | snd_hda_codec_write(codec, 0x15, 0, |
| 939 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 940 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 941 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 942 | switch (codec->vendor_id) { |
| 943 | case 0x10ec0260: |
| 944 | snd_hda_codec_write(codec, 0x1a, 0, |
| 945 | AC_VERB_SET_COEF_INDEX, 7); |
| 946 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 947 | AC_VERB_GET_PROC_COEF, 0); |
| 948 | snd_hda_codec_write(codec, 0x1a, 0, |
| 949 | AC_VERB_SET_COEF_INDEX, 7); |
| 950 | snd_hda_codec_write(codec, 0x1a, 0, |
| 951 | AC_VERB_SET_PROC_COEF, |
| 952 | tmp | 0x2010); |
| 953 | break; |
| 954 | case 0x10ec0262: |
| 955 | case 0x10ec0880: |
| 956 | case 0x10ec0882: |
| 957 | case 0x10ec0883: |
| 958 | case 0x10ec0885: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 959 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 960 | snd_hda_codec_write(codec, 0x20, 0, |
| 961 | AC_VERB_SET_COEF_INDEX, 7); |
| 962 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 963 | AC_VERB_GET_PROC_COEF, 0); |
| 964 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 965 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 966 | snd_hda_codec_write(codec, 0x20, 0, |
| 967 | AC_VERB_SET_PROC_COEF, |
| 968 | tmp | 0x2010); |
| 969 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 970 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 971 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 972 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 973 | case 0x10ec0267: |
| 974 | case 0x10ec0268: |
| 975 | snd_hda_codec_write(codec, 0x20, 0, |
| 976 | AC_VERB_SET_COEF_INDEX, 7); |
| 977 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 978 | AC_VERB_GET_PROC_COEF, 0); |
| 979 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 980 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 981 | snd_hda_codec_write(codec, 0x20, 0, |
| 982 | AC_VERB_SET_PROC_COEF, |
| 983 | tmp | 0x3000); |
| 984 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 985 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 986 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 987 | break; |
| 988 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 989 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 990 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 991 | * when the external headphone out jack is plugged" |
| 992 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 993 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 994 | return; |
| 995 | /* |
| 996 | * 10~8 : Jack location |
| 997 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 998 | * 14~13: Resvered |
| 999 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1000 | * when the external headphone out jack is plugged" |
| 1001 | */ |
| 1002 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1003 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1004 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1005 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1006 | else |
| 1007 | return; |
| 1008 | } |
| 1009 | |
| 1010 | if (!spec->autocfg.hp_pins[0]) { |
| 1011 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1012 | if (tmp == 0) |
| 1013 | spec->autocfg.hp_pins[0] = porta; |
| 1014 | else if (tmp == 1) |
| 1015 | spec->autocfg.hp_pins[0] = porte; |
| 1016 | else if (tmp == 2) |
| 1017 | spec->autocfg.hp_pins[0] = portd; |
| 1018 | else |
| 1019 | return; |
| 1020 | } |
| 1021 | |
| 1022 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1023 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1024 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1025 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1026 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1027 | } |
| 1028 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1029 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1030 | * Fix-up pin default configurations |
| 1031 | */ |
| 1032 | |
| 1033 | struct alc_pincfg { |
| 1034 | hda_nid_t nid; |
| 1035 | u32 val; |
| 1036 | }; |
| 1037 | |
| 1038 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1039 | const struct snd_pci_quirk *quirk, |
| 1040 | const struct alc_pincfg **pinfix) |
| 1041 | { |
| 1042 | const struct alc_pincfg *cfg; |
| 1043 | |
| 1044 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1045 | if (!quirk) |
| 1046 | return; |
| 1047 | |
| 1048 | cfg = pinfix[quirk->value]; |
| 1049 | for (; cfg->nid; cfg++) { |
| 1050 | int i; |
| 1051 | u32 val = cfg->val; |
| 1052 | for (i = 0; i < 4; i++) { |
| 1053 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1054 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1055 | val & 0xff); |
| 1056 | val >>= 8; |
| 1057 | } |
| 1058 | } |
| 1059 | } |
| 1060 | |
| 1061 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1062 | * ALC880 3-stack model |
| 1063 | * |
| 1064 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1065 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1066 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1067 | */ |
| 1068 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1069 | static hda_nid_t alc880_dac_nids[4] = { |
| 1070 | /* front, rear, clfe, rear_surr */ |
| 1071 | 0x02, 0x05, 0x04, 0x03 |
| 1072 | }; |
| 1073 | |
| 1074 | static hda_nid_t alc880_adc_nids[3] = { |
| 1075 | /* ADC0-2 */ |
| 1076 | 0x07, 0x08, 0x09, |
| 1077 | }; |
| 1078 | |
| 1079 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1080 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1081 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1082 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1083 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1084 | /* ADC1-2 */ |
| 1085 | 0x08, 0x09, |
| 1086 | }; |
| 1087 | |
| 1088 | #define ALC880_DIGOUT_NID 0x06 |
| 1089 | #define ALC880_DIGIN_NID 0x0a |
| 1090 | |
| 1091 | static struct hda_input_mux alc880_capture_source = { |
| 1092 | .num_items = 4, |
| 1093 | .items = { |
| 1094 | { "Mic", 0x0 }, |
| 1095 | { "Front Mic", 0x3 }, |
| 1096 | { "Line", 0x2 }, |
| 1097 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1098 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1099 | }; |
| 1100 | |
| 1101 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1102 | /* 2ch mode */ |
| 1103 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1104 | /* set line-in to input, mute it */ |
| 1105 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1106 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1107 | /* set mic-in to input vref 80%, mute it */ |
| 1108 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1109 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1110 | { } /* end */ |
| 1111 | }; |
| 1112 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1113 | /* 6ch mode */ |
| 1114 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1115 | /* set line-in to output, unmute it */ |
| 1116 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1117 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1118 | /* set mic-in to output, unmute it */ |
| 1119 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1120 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1121 | { } /* end */ |
| 1122 | }; |
| 1123 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1124 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1125 | { 2, alc880_threestack_ch2_init }, |
| 1126 | { 6, alc880_threestack_ch6_init }, |
| 1127 | }; |
| 1128 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1129 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1131 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1132 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1133 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1134 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1135 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1136 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1137 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1138 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1139 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1140 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1141 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1142 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1143 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1144 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1145 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1146 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1147 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1148 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1149 | { |
| 1150 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1151 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1152 | .info = alc_ch_mode_info, |
| 1153 | .get = alc_ch_mode_get, |
| 1154 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1155 | }, |
| 1156 | { } /* end */ |
| 1157 | }; |
| 1158 | |
| 1159 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1160 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1161 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1162 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1163 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1164 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1165 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1166 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1167 | { |
| 1168 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1169 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1170 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1171 | */ |
| 1172 | /* .name = "Capture Source", */ |
| 1173 | .name = "Input Source", |
| 1174 | .count = 3, |
| 1175 | .info = alc_mux_enum_info, |
| 1176 | .get = alc_mux_enum_get, |
| 1177 | .put = alc_mux_enum_put, |
| 1178 | }, |
| 1179 | { } /* end */ |
| 1180 | }; |
| 1181 | |
| 1182 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1183 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1184 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1185 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1186 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1187 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1188 | { |
| 1189 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1190 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1191 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1192 | */ |
| 1193 | /* .name = "Capture Source", */ |
| 1194 | .name = "Input Source", |
| 1195 | .count = 2, |
| 1196 | .info = alc_mux_enum_info, |
| 1197 | .get = alc_mux_enum_get, |
| 1198 | .put = alc_mux_enum_put, |
| 1199 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1200 | { } /* end */ |
| 1201 | }; |
| 1202 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1203 | |
| 1204 | |
| 1205 | /* |
| 1206 | * ALC880 5-stack model |
| 1207 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1208 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1209 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1210 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1211 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1212 | */ |
| 1213 | |
| 1214 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1215 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1216 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1217 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1218 | { } /* end */ |
| 1219 | }; |
| 1220 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1221 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1222 | /* 6ch mode */ |
| 1223 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1224 | /* set line-in to input, mute it */ |
| 1225 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1226 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1227 | { } /* end */ |
| 1228 | }; |
| 1229 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1230 | /* 8ch mode */ |
| 1231 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1232 | /* set line-in to output, unmute it */ |
| 1233 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1234 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1235 | { } /* end */ |
| 1236 | }; |
| 1237 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1238 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1239 | { 6, alc880_fivestack_ch6_init }, |
| 1240 | { 8, alc880_fivestack_ch8_init }, |
| 1241 | }; |
| 1242 | |
| 1243 | |
| 1244 | /* |
| 1245 | * ALC880 6-stack model |
| 1246 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1247 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1248 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1249 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1250 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1251 | */ |
| 1252 | |
| 1253 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1254 | /* front, rear, clfe, rear_surr */ |
| 1255 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1256 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1257 | |
| 1258 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1259 | .num_items = 4, |
| 1260 | .items = { |
| 1261 | { "Mic", 0x0 }, |
| 1262 | { "Front Mic", 0x1 }, |
| 1263 | { "Line", 0x2 }, |
| 1264 | { "CD", 0x4 }, |
| 1265 | }, |
| 1266 | }; |
| 1267 | |
| 1268 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1269 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1270 | { 8, NULL }, |
| 1271 | }; |
| 1272 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1273 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1274 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1275 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1276 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1277 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1278 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1279 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1280 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1281 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1282 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1283 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1284 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1285 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1286 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1287 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1288 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1289 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1290 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1291 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1292 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1293 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1294 | { |
| 1295 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1296 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1297 | .info = alc_ch_mode_info, |
| 1298 | .get = alc_ch_mode_get, |
| 1299 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1300 | }, |
| 1301 | { } /* end */ |
| 1302 | }; |
| 1303 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1304 | |
| 1305 | /* |
| 1306 | * ALC880 W810 model |
| 1307 | * |
| 1308 | * W810 has rear IO for: |
| 1309 | * Front (DAC 02) |
| 1310 | * Surround (DAC 03) |
| 1311 | * Center/LFE (DAC 04) |
| 1312 | * Digital out (06) |
| 1313 | * |
| 1314 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1315 | * 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] | 1316 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1317 | * There is a variable resistor to control the speaker or headphone |
| 1318 | * volume. This is a hardware-only device without a software API. |
| 1319 | * |
| 1320 | * Plugging headphones in will disable the internal speakers. This is |
| 1321 | * implemented in hardware, not via the driver using jack sense. In |
| 1322 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1323 | * disable both the speakers and headphones. |
| 1324 | * |
| 1325 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1326 | * These may not do anything useful with this driver yet, because I |
| 1327 | * haven't setup any initialization verbs for these yet... |
| 1328 | */ |
| 1329 | |
| 1330 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1331 | /* front, rear/surround, clfe */ |
| 1332 | 0x02, 0x03, 0x04 |
| 1333 | }; |
| 1334 | |
| 1335 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1336 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1337 | { 6, NULL } |
| 1338 | }; |
| 1339 | |
| 1340 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1341 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1342 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1343 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1344 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1345 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1346 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1347 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1348 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1349 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1350 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1351 | { } /* end */ |
| 1352 | }; |
| 1353 | |
| 1354 | |
| 1355 | /* |
| 1356 | * Z710V model |
| 1357 | * |
| 1358 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1359 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1360 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1361 | */ |
| 1362 | |
| 1363 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1364 | 0x02 |
| 1365 | }; |
| 1366 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1367 | |
| 1368 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1369 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1370 | { 2, NULL } |
| 1371 | }; |
| 1372 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1373 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1374 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1375 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1376 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1377 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1378 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1379 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1380 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1381 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1382 | { } /* end */ |
| 1383 | }; |
| 1384 | |
| 1385 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1386 | /* |
| 1387 | * ALC880 F1734 model |
| 1388 | * |
| 1389 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1390 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1391 | */ |
| 1392 | |
| 1393 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1394 | 0x03 |
| 1395 | }; |
| 1396 | #define ALC880_F1734_HP_DAC 0x02 |
| 1397 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1398 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1399 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1400 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1401 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1402 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1403 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1404 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1405 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1406 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1407 | { } /* end */ |
| 1408 | }; |
| 1409 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1410 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1411 | .num_items = 2, |
| 1412 | .items = { |
| 1413 | { "Mic", 0x1 }, |
| 1414 | { "CD", 0x4 }, |
| 1415 | }, |
| 1416 | }; |
| 1417 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1418 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1419 | /* |
| 1420 | * ALC880 ASUS model |
| 1421 | * |
| 1422 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1423 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1424 | * Mic = 0x18, Line = 0x1a |
| 1425 | */ |
| 1426 | |
| 1427 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1428 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1429 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1430 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1431 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1432 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1433 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1434 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1435 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1436 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1437 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1438 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1439 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1440 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1441 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1442 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1443 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1444 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1445 | { |
| 1446 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1447 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1448 | .info = alc_ch_mode_info, |
| 1449 | .get = alc_ch_mode_get, |
| 1450 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1451 | }, |
| 1452 | { } /* end */ |
| 1453 | }; |
| 1454 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1455 | /* |
| 1456 | * ALC880 ASUS W1V model |
| 1457 | * |
| 1458 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1459 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1460 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1461 | */ |
| 1462 | |
| 1463 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1464 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1465 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1466 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1467 | { } /* end */ |
| 1468 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1469 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1470 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1471 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1472 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1473 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1474 | { } /* end */ |
| 1475 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1476 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1477 | /* TCL S700 */ |
| 1478 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1479 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1480 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1481 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1482 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1483 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1484 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1485 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1486 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1487 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1488 | { |
| 1489 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1490 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1491 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1492 | */ |
| 1493 | /* .name = "Capture Source", */ |
| 1494 | .name = "Input Source", |
| 1495 | .count = 1, |
| 1496 | .info = alc_mux_enum_info, |
| 1497 | .get = alc_mux_enum_get, |
| 1498 | .put = alc_mux_enum_put, |
| 1499 | }, |
| 1500 | { } /* end */ |
| 1501 | }; |
| 1502 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1503 | /* Uniwill */ |
| 1504 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1505 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1506 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1507 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1508 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1509 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1510 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1511 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1512 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1513 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1514 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1515 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1516 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1517 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1518 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1519 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1520 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1521 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1522 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1523 | { |
| 1524 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1525 | .name = "Channel Mode", |
| 1526 | .info = alc_ch_mode_info, |
| 1527 | .get = alc_ch_mode_get, |
| 1528 | .put = alc_ch_mode_put, |
| 1529 | }, |
| 1530 | { } /* end */ |
| 1531 | }; |
| 1532 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1533 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1534 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1535 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1536 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1537 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1538 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1539 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1540 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1541 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1542 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1543 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1544 | { } /* end */ |
| 1545 | }; |
| 1546 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1547 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1548 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1549 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1550 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1551 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1552 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1553 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1554 | { } /* end */ |
| 1555 | }; |
| 1556 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1557 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1558 | * virtual master controls |
| 1559 | */ |
| 1560 | |
| 1561 | /* |
| 1562 | * slave controls for virtual master |
| 1563 | */ |
| 1564 | static const char *alc_slave_vols[] = { |
| 1565 | "Front Playback Volume", |
| 1566 | "Surround Playback Volume", |
| 1567 | "Center Playback Volume", |
| 1568 | "LFE Playback Volume", |
| 1569 | "Side Playback Volume", |
| 1570 | "Headphone Playback Volume", |
| 1571 | "Speaker Playback Volume", |
| 1572 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1573 | "Line-Out Playback Volume", |
| 1574 | NULL, |
| 1575 | }; |
| 1576 | |
| 1577 | static const char *alc_slave_sws[] = { |
| 1578 | "Front Playback Switch", |
| 1579 | "Surround Playback Switch", |
| 1580 | "Center Playback Switch", |
| 1581 | "LFE Playback Switch", |
| 1582 | "Side Playback Switch", |
| 1583 | "Headphone Playback Switch", |
| 1584 | "Speaker Playback Switch", |
| 1585 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1586 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1587 | NULL, |
| 1588 | }; |
| 1589 | |
| 1590 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1591 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1592 | */ |
| 1593 | static int alc_build_controls(struct hda_codec *codec) |
| 1594 | { |
| 1595 | struct alc_spec *spec = codec->spec; |
| 1596 | int err; |
| 1597 | int i; |
| 1598 | |
| 1599 | for (i = 0; i < spec->num_mixers; i++) { |
| 1600 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1601 | if (err < 0) |
| 1602 | return err; |
| 1603 | } |
| 1604 | |
| 1605 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1606 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1607 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1608 | if (err < 0) |
| 1609 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1610 | err = snd_hda_create_spdif_share_sw(codec, |
| 1611 | &spec->multiout); |
| 1612 | if (err < 0) |
| 1613 | return err; |
| 1614 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1615 | } |
| 1616 | if (spec->dig_in_nid) { |
| 1617 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1618 | if (err < 0) |
| 1619 | return err; |
| 1620 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1621 | |
| 1622 | /* if we have no master control, let's create it */ |
| 1623 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1624 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1625 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1626 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1627 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1628 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1629 | if (err < 0) |
| 1630 | return err; |
| 1631 | } |
| 1632 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1633 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1634 | NULL, alc_slave_sws); |
| 1635 | if (err < 0) |
| 1636 | return err; |
| 1637 | } |
| 1638 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1639 | return 0; |
| 1640 | } |
| 1641 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1642 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1643 | /* |
| 1644 | * initialize the codec volumes, etc |
| 1645 | */ |
| 1646 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1647 | /* |
| 1648 | * generic initialization of ADC, input mixers and output mixers |
| 1649 | */ |
| 1650 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1651 | /* |
| 1652 | * Unmute ADC0-2 and set the default input to mic-in |
| 1653 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1654 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1655 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1656 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1657 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1658 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1659 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1660 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1661 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1662 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1663 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1664 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1665 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1666 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1667 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1668 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1669 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1670 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1671 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1672 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1673 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1674 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1675 | /* |
| 1676 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1677 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1678 | /* set vol=0 to output mixers */ |
| 1679 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1680 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1681 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1682 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1683 | /* set up input amps for analog loopback */ |
| 1684 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1685 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1686 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1687 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1688 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1689 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1690 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1691 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1692 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1693 | |
| 1694 | { } |
| 1695 | }; |
| 1696 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1697 | /* |
| 1698 | * 3-stack pin configuration: |
| 1699 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1700 | */ |
| 1701 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1702 | /* |
| 1703 | * preset connection lists of input pins |
| 1704 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1705 | */ |
| 1706 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1707 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1708 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1709 | |
| 1710 | /* |
| 1711 | * Set pin mode and muting |
| 1712 | */ |
| 1713 | /* set front pin widgets 0x14 for output */ |
| 1714 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1715 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1716 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1717 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1718 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1719 | /* Mic2 (as headphone out) for HP output */ |
| 1720 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1721 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1722 | /* Line In pin widget for input */ |
| 1723 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1724 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1725 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1726 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1727 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1728 | /* CD pin widget for input */ |
| 1729 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1730 | |
| 1731 | { } |
| 1732 | }; |
| 1733 | |
| 1734 | /* |
| 1735 | * 5-stack pin configuration: |
| 1736 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1737 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1738 | */ |
| 1739 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1740 | /* |
| 1741 | * preset connection lists of input pins |
| 1742 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1743 | */ |
| 1744 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1745 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1746 | |
| 1747 | /* |
| 1748 | * Set pin mode and muting |
| 1749 | */ |
| 1750 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1751 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1752 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1753 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1754 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1755 | /* unmute pins for output (no gain on this amp) */ |
| 1756 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1757 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1758 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1759 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1760 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1761 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1762 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1763 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1764 | /* Mic2 (as headphone out) for HP output */ |
| 1765 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1766 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1767 | /* Line In pin widget for input */ |
| 1768 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1769 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1770 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1771 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1772 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1773 | /* CD pin widget for input */ |
| 1774 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1775 | |
| 1776 | { } |
| 1777 | }; |
| 1778 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1779 | /* |
| 1780 | * W810 pin configuration: |
| 1781 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1782 | */ |
| 1783 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1784 | /* hphone/speaker input selector: front DAC */ |
| 1785 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1786 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1787 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1788 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1789 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1790 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1791 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1792 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1793 | |
| 1794 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1795 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1796 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1797 | { } |
| 1798 | }; |
| 1799 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1800 | /* |
| 1801 | * Z71V pin configuration: |
| 1802 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1803 | */ |
| 1804 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1805 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1806 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1807 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1808 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1809 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1810 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1811 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1812 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1813 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1814 | |
| 1815 | { } |
| 1816 | }; |
| 1817 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1818 | /* |
| 1819 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1820 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1821 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1822 | */ |
| 1823 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1824 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1825 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1826 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1827 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1828 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1829 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1830 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1831 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1832 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1833 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1834 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1835 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1836 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1837 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1838 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1839 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1840 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1841 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1842 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1843 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1844 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1845 | { } |
| 1846 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1847 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1848 | /* |
| 1849 | * Uniwill pin configuration: |
| 1850 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1851 | * line = 0x1a |
| 1852 | */ |
| 1853 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1854 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1855 | |
| 1856 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1857 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1858 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1859 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1860 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1861 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1862 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1863 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1864 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1865 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1866 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1867 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1868 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1869 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1870 | |
| 1871 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1872 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1873 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1874 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1875 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1876 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1877 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1878 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1879 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1880 | |
| 1881 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1882 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1883 | |
| 1884 | { } |
| 1885 | }; |
| 1886 | |
| 1887 | /* |
| 1888 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1889 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1890 | */ |
| 1891 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1892 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1893 | |
| 1894 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1895 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1896 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1897 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1898 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1899 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1900 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1901 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1902 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1903 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1904 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1905 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1906 | |
| 1907 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1908 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1909 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1910 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1911 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1912 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1913 | |
| 1914 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1915 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1916 | |
| 1917 | { } |
| 1918 | }; |
| 1919 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1920 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1921 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1922 | { } |
| 1923 | }; |
| 1924 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1925 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1926 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1927 | { |
| 1928 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1929 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1930 | |
| 1931 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1932 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1933 | bits = present ? HDA_AMP_MUTE : 0; |
| 1934 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1935 | HDA_AMP_MUTE, bits); |
| 1936 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1937 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1938 | } |
| 1939 | |
| 1940 | /* auto-toggle front mic */ |
| 1941 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1942 | { |
| 1943 | unsigned int present; |
| 1944 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1945 | |
| 1946 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1947 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1948 | bits = present ? HDA_AMP_MUTE : 0; |
| 1949 | 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] | 1950 | } |
| 1951 | |
| 1952 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1953 | { |
| 1954 | alc880_uniwill_hp_automute(codec); |
| 1955 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1956 | } |
| 1957 | |
| 1958 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1959 | unsigned int res) |
| 1960 | { |
| 1961 | /* Looks like the unsol event is incompatible with the standard |
| 1962 | * definition. 4bit tag is placed at 28 bit! |
| 1963 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1964 | switch (res >> 28) { |
| 1965 | case ALC880_HP_EVENT: |
| 1966 | alc880_uniwill_hp_automute(codec); |
| 1967 | break; |
| 1968 | case ALC880_MIC_EVENT: |
| 1969 | alc880_uniwill_mic_automute(codec); |
| 1970 | break; |
| 1971 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1972 | } |
| 1973 | |
| 1974 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1975 | { |
| 1976 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1977 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1978 | |
| 1979 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1980 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1981 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 1982 | 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] | 1983 | } |
| 1984 | |
| 1985 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1986 | { |
| 1987 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1988 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1989 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1990 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1991 | present &= HDA_AMP_VOLMASK; |
| 1992 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1993 | HDA_AMP_VOLMASK, present); |
| 1994 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1995 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1996 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1997 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1998 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1999 | unsigned int res) |
| 2000 | { |
| 2001 | /* Looks like the unsol event is incompatible with the standard |
| 2002 | * definition. 4bit tag is placed at 28 bit! |
| 2003 | */ |
| 2004 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2005 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2006 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2007 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2008 | } |
| 2009 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2010 | /* |
| 2011 | * F1734 pin configuration: |
| 2012 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2013 | */ |
| 2014 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2015 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2016 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2017 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2018 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2019 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2020 | |
| 2021 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2022 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2023 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2024 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2025 | |
| 2026 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2027 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2028 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2029 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2030 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2031 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2032 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2033 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2034 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2035 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2036 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2037 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2038 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2039 | { } |
| 2040 | }; |
| 2041 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2042 | /* |
| 2043 | * ASUS pin configuration: |
| 2044 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2045 | */ |
| 2046 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2047 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2048 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2049 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2050 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2051 | |
| 2052 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2053 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2054 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2055 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2056 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2057 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2058 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2059 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2060 | |
| 2061 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2062 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2063 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2064 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2065 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2066 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2067 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2068 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2069 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2070 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2071 | { } |
| 2072 | }; |
| 2073 | |
| 2074 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2075 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2076 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2077 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2078 | /* Clevo m520g init */ |
| 2079 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2080 | /* headphone output */ |
| 2081 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2082 | /* line-out */ |
| 2083 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2084 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2085 | /* Line-in */ |
| 2086 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2087 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2088 | /* CD */ |
| 2089 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2090 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2091 | /* Mic1 (rear panel) */ |
| 2092 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2093 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2094 | /* Mic2 (front panel) */ |
| 2095 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2096 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2097 | /* headphone */ |
| 2098 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2099 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2100 | /* change to EAPD mode */ |
| 2101 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2102 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2103 | |
| 2104 | { } |
| 2105 | }; |
| 2106 | |
| 2107 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2108 | /* change to EAPD mode */ |
| 2109 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2110 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2111 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2112 | /* Headphone output */ |
| 2113 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2114 | /* Front output*/ |
| 2115 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2116 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2117 | |
| 2118 | /* Line In pin widget for input */ |
| 2119 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2120 | /* CD pin widget for input */ |
| 2121 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2122 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2123 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2124 | |
| 2125 | /* change to EAPD mode */ |
| 2126 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2127 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2128 | |
| 2129 | { } |
| 2130 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2131 | |
| 2132 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2133 | * LG m1 express dual |
| 2134 | * |
| 2135 | * Pin assignment: |
| 2136 | * Rear Line-In/Out (blue): 0x14 |
| 2137 | * Build-in Mic-In: 0x15 |
| 2138 | * Speaker-out: 0x17 |
| 2139 | * HP-Out (green): 0x1b |
| 2140 | * Mic-In/Out (red): 0x19 |
| 2141 | * SPDIF-Out: 0x1e |
| 2142 | */ |
| 2143 | |
| 2144 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2145 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2146 | 0x05, 0x02, 0x03 |
| 2147 | }; |
| 2148 | |
| 2149 | /* seems analog CD is not working */ |
| 2150 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2151 | .num_items = 3, |
| 2152 | .items = { |
| 2153 | { "Mic", 0x1 }, |
| 2154 | { "Line", 0x5 }, |
| 2155 | { "Internal Mic", 0x6 }, |
| 2156 | }, |
| 2157 | }; |
| 2158 | |
| 2159 | /* 2,4,6 channel modes */ |
| 2160 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2161 | /* set line-in and mic-in to input */ |
| 2162 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2163 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2164 | { } |
| 2165 | }; |
| 2166 | |
| 2167 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2168 | /* set line-in to out and mic-in to input */ |
| 2169 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2170 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2171 | { } |
| 2172 | }; |
| 2173 | |
| 2174 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2175 | /* set line-in and mic-in to output */ |
| 2176 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2177 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2178 | { } |
| 2179 | }; |
| 2180 | |
| 2181 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2182 | { 2, alc880_lg_ch2_init }, |
| 2183 | { 4, alc880_lg_ch4_init }, |
| 2184 | { 6, alc880_lg_ch6_init }, |
| 2185 | }; |
| 2186 | |
| 2187 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2188 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2189 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2190 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2191 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2192 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2193 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2194 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2195 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2196 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2197 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2198 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2199 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2200 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2201 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2202 | { |
| 2203 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2204 | .name = "Channel Mode", |
| 2205 | .info = alc_ch_mode_info, |
| 2206 | .get = alc_ch_mode_get, |
| 2207 | .put = alc_ch_mode_put, |
| 2208 | }, |
| 2209 | { } /* end */ |
| 2210 | }; |
| 2211 | |
| 2212 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2213 | /* set capture source to mic-in */ |
| 2214 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2215 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2216 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2217 | /* mute all amp mixer inputs */ |
| 2218 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2219 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2220 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2221 | /* line-in to input */ |
| 2222 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2223 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2224 | /* built-in mic */ |
| 2225 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2226 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2227 | /* speaker-out */ |
| 2228 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2229 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2230 | /* mic-in to input */ |
| 2231 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2232 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2233 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2234 | /* HP-out */ |
| 2235 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2236 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2237 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2238 | /* jack sense */ |
| 2239 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2240 | { } |
| 2241 | }; |
| 2242 | |
| 2243 | /* toggle speaker-output according to the hp-jack state */ |
| 2244 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2245 | { |
| 2246 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2247 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2248 | |
| 2249 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2250 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2251 | bits = present ? HDA_AMP_MUTE : 0; |
| 2252 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2253 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2254 | } |
| 2255 | |
| 2256 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2257 | { |
| 2258 | /* Looks like the unsol event is incompatible with the standard |
| 2259 | * definition. 4bit tag is placed at 28 bit! |
| 2260 | */ |
| 2261 | if ((res >> 28) == 0x01) |
| 2262 | alc880_lg_automute(codec); |
| 2263 | } |
| 2264 | |
| 2265 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2266 | * LG LW20 |
| 2267 | * |
| 2268 | * Pin assignment: |
| 2269 | * Speaker-out: 0x14 |
| 2270 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2271 | * Built-in Mic-In: 0x19 |
| 2272 | * Line-In: 0x1b |
| 2273 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2274 | * SPDIF-Out: 0x1e |
| 2275 | */ |
| 2276 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2277 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2278 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2279 | .items = { |
| 2280 | { "Mic", 0x0 }, |
| 2281 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2282 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2283 | }, |
| 2284 | }; |
| 2285 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2286 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2287 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2288 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2289 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2290 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2291 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2292 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2293 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2294 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2295 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2296 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2297 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2298 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2299 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2300 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2301 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2302 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2303 | { |
| 2304 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2305 | .name = "Channel Mode", |
| 2306 | .info = alc_ch_mode_info, |
| 2307 | .get = alc_ch_mode_get, |
| 2308 | .put = alc_ch_mode_put, |
| 2309 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2310 | { } /* end */ |
| 2311 | }; |
| 2312 | |
| 2313 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2314 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2315 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2316 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2317 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2318 | /* set capture source to mic-in */ |
| 2319 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2320 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2321 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2322 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2323 | /* speaker-out */ |
| 2324 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2325 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2326 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2327 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2328 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2329 | /* mic-in to input */ |
| 2330 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2331 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2332 | /* built-in mic */ |
| 2333 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2334 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2335 | /* jack sense */ |
| 2336 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2337 | { } |
| 2338 | }; |
| 2339 | |
| 2340 | /* toggle speaker-output according to the hp-jack state */ |
| 2341 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2342 | { |
| 2343 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2344 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2345 | |
| 2346 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2347 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2348 | bits = present ? HDA_AMP_MUTE : 0; |
| 2349 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2350 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2351 | } |
| 2352 | |
| 2353 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2354 | { |
| 2355 | /* Looks like the unsol event is incompatible with the standard |
| 2356 | * definition. 4bit tag is placed at 28 bit! |
| 2357 | */ |
| 2358 | if ((res >> 28) == 0x01) |
| 2359 | alc880_lg_lw_automute(codec); |
| 2360 | } |
| 2361 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2362 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2363 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2364 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2365 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2366 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2367 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2368 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2369 | { } /* end */ |
| 2370 | }; |
| 2371 | |
| 2372 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2373 | .num_items = 2, |
| 2374 | .items = { |
| 2375 | { "Mic", 0x0 }, |
| 2376 | { "Internal Mic", 0x1 }, |
| 2377 | }, |
| 2378 | }; |
| 2379 | |
| 2380 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2381 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2382 | |
| 2383 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2384 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2385 | |
| 2386 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2387 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2388 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2389 | /* Mic2 (as headphone out) for HP output */ |
| 2390 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2391 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2392 | /* Internal Speaker */ |
| 2393 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2394 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2395 | |
| 2396 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2397 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2398 | |
| 2399 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2400 | { } |
| 2401 | }; |
| 2402 | |
| 2403 | /* toggle speaker-output according to the hp-jack state */ |
| 2404 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2405 | { |
| 2406 | unsigned int present; |
| 2407 | unsigned char bits; |
| 2408 | |
| 2409 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2410 | AC_VERB_GET_PIN_SENSE, 0) |
| 2411 | & AC_PINSENSE_PRESENCE; |
| 2412 | bits = present ? HDA_AMP_MUTE : 0; |
| 2413 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2414 | HDA_AMP_MUTE, bits); |
| 2415 | if (present) |
| 2416 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2417 | else |
| 2418 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2419 | } |
| 2420 | |
| 2421 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2422 | unsigned int res) |
| 2423 | { |
| 2424 | /* Looks like the unsol event is incompatible with the standard |
| 2425 | * definition. 4bit tag is placed at 28 bit! |
| 2426 | */ |
| 2427 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2428 | alc880_medion_rim_automute(codec); |
| 2429 | } |
| 2430 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2431 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2432 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2433 | { 0x0b, HDA_INPUT, 0 }, |
| 2434 | { 0x0b, HDA_INPUT, 1 }, |
| 2435 | { 0x0b, HDA_INPUT, 2 }, |
| 2436 | { 0x0b, HDA_INPUT, 3 }, |
| 2437 | { 0x0b, HDA_INPUT, 4 }, |
| 2438 | { } /* end */ |
| 2439 | }; |
| 2440 | |
| 2441 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2442 | { 0x0b, HDA_INPUT, 1 }, |
| 2443 | { 0x0b, HDA_INPUT, 6 }, |
| 2444 | { 0x0b, HDA_INPUT, 7 }, |
| 2445 | { } /* end */ |
| 2446 | }; |
| 2447 | #endif |
| 2448 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2449 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2450 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2451 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2452 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2453 | static int alc_init(struct hda_codec *codec) |
| 2454 | { |
| 2455 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2456 | unsigned int i; |
| 2457 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2458 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2459 | if (codec->vendor_id == 0x10ec0888) |
| 2460 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2461 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2462 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2463 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2464 | |
| 2465 | if (spec->init_hook) |
| 2466 | spec->init_hook(codec); |
| 2467 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2468 | return 0; |
| 2469 | } |
| 2470 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2471 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2472 | { |
| 2473 | struct alc_spec *spec = codec->spec; |
| 2474 | |
| 2475 | if (spec->unsol_event) |
| 2476 | spec->unsol_event(codec, res); |
| 2477 | } |
| 2478 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2479 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2480 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2481 | { |
| 2482 | struct alc_spec *spec = codec->spec; |
| 2483 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2484 | } |
| 2485 | #endif |
| 2486 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2487 | /* |
| 2488 | * Analog playback callbacks |
| 2489 | */ |
| 2490 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2491 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2492 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2493 | { |
| 2494 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2495 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2496 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2497 | } |
| 2498 | |
| 2499 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2500 | struct hda_codec *codec, |
| 2501 | unsigned int stream_tag, |
| 2502 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2503 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2504 | { |
| 2505 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2506 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2507 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2508 | } |
| 2509 | |
| 2510 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2511 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2512 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2513 | { |
| 2514 | struct alc_spec *spec = codec->spec; |
| 2515 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2516 | } |
| 2517 | |
| 2518 | /* |
| 2519 | * Digital out |
| 2520 | */ |
| 2521 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2522 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2523 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2524 | { |
| 2525 | struct alc_spec *spec = codec->spec; |
| 2526 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2527 | } |
| 2528 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2529 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2530 | struct hda_codec *codec, |
| 2531 | unsigned int stream_tag, |
| 2532 | unsigned int format, |
| 2533 | struct snd_pcm_substream *substream) |
| 2534 | { |
| 2535 | struct alc_spec *spec = codec->spec; |
| 2536 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2537 | stream_tag, format, substream); |
| 2538 | } |
| 2539 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2540 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2541 | struct hda_codec *codec, |
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 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2546 | } |
| 2547 | |
| 2548 | /* |
| 2549 | * Analog capture |
| 2550 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2551 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2552 | struct hda_codec *codec, |
| 2553 | unsigned int stream_tag, |
| 2554 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2555 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2556 | { |
| 2557 | struct alc_spec *spec = codec->spec; |
| 2558 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2559 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2560 | stream_tag, 0, format); |
| 2561 | return 0; |
| 2562 | } |
| 2563 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2564 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2565 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2566 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2567 | { |
| 2568 | struct alc_spec *spec = codec->spec; |
| 2569 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2570 | snd_hda_codec_cleanup_stream(codec, |
| 2571 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2572 | return 0; |
| 2573 | } |
| 2574 | |
| 2575 | |
| 2576 | /* |
| 2577 | */ |
| 2578 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2579 | .substreams = 1, |
| 2580 | .channels_min = 2, |
| 2581 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2582 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2583 | .ops = { |
| 2584 | .open = alc880_playback_pcm_open, |
| 2585 | .prepare = alc880_playback_pcm_prepare, |
| 2586 | .cleanup = alc880_playback_pcm_cleanup |
| 2587 | }, |
| 2588 | }; |
| 2589 | |
| 2590 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2591 | .substreams = 1, |
| 2592 | .channels_min = 2, |
| 2593 | .channels_max = 2, |
| 2594 | /* NID is set in alc_build_pcms */ |
| 2595 | }; |
| 2596 | |
| 2597 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2598 | .substreams = 1, |
| 2599 | .channels_min = 2, |
| 2600 | .channels_max = 2, |
| 2601 | /* NID is set in alc_build_pcms */ |
| 2602 | }; |
| 2603 | |
| 2604 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2605 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2606 | .channels_min = 2, |
| 2607 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2608 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2609 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2610 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2611 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2612 | }, |
| 2613 | }; |
| 2614 | |
| 2615 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2616 | .substreams = 1, |
| 2617 | .channels_min = 2, |
| 2618 | .channels_max = 2, |
| 2619 | /* NID is set in alc_build_pcms */ |
| 2620 | .ops = { |
| 2621 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2622 | .close = alc880_dig_playback_pcm_close, |
| 2623 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2624 | }, |
| 2625 | }; |
| 2626 | |
| 2627 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2628 | .substreams = 1, |
| 2629 | .channels_min = 2, |
| 2630 | .channels_max = 2, |
| 2631 | /* NID is set in alc_build_pcms */ |
| 2632 | }; |
| 2633 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2634 | /* 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] | 2635 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2636 | .substreams = 0, |
| 2637 | .channels_min = 0, |
| 2638 | .channels_max = 0, |
| 2639 | }; |
| 2640 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2641 | static int alc_build_pcms(struct hda_codec *codec) |
| 2642 | { |
| 2643 | struct alc_spec *spec = codec->spec; |
| 2644 | struct hda_pcm *info = spec->pcm_rec; |
| 2645 | int i; |
| 2646 | |
| 2647 | codec->num_pcms = 1; |
| 2648 | codec->pcm_info = info; |
| 2649 | |
| 2650 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2651 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2652 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 2653 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2654 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2655 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2656 | } |
| 2657 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2658 | if (snd_BUG_ON(!spec->adc_nids)) |
| 2659 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2660 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2661 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2662 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2663 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2664 | if (spec->channel_mode) { |
| 2665 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2666 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2667 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2668 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2669 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2670 | } |
| 2671 | } |
| 2672 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2673 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2674 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2675 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2676 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2677 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2678 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2679 | if (spec->multiout.dig_out_nid && |
| 2680 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2681 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2682 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2683 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2684 | if (spec->dig_in_nid && |
| 2685 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2686 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2687 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2688 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 2689 | /* FIXME: do we need this for all Realtek codec models? */ |
| 2690 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2691 | } |
| 2692 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2693 | /* If the use of more than one ADC is requested for the current |
| 2694 | * model, configure a second analog capture-only PCM. |
| 2695 | */ |
| 2696 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2697 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2698 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2699 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2700 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2701 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2702 | if (spec->alt_dac_nid) { |
| 2703 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2704 | *spec->stream_analog_alt_playback; |
| 2705 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2706 | spec->alt_dac_nid; |
| 2707 | } else { |
| 2708 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2709 | alc_pcm_null_stream; |
| 2710 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2711 | } |
| 2712 | if (spec->num_adc_nids > 1) { |
| 2713 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2714 | *spec->stream_analog_alt_capture; |
| 2715 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2716 | spec->adc_nids[1]; |
| 2717 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2718 | spec->num_adc_nids - 1; |
| 2719 | } else { |
| 2720 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2721 | alc_pcm_null_stream; |
| 2722 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2723 | } |
| 2724 | } |
| 2725 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2726 | return 0; |
| 2727 | } |
| 2728 | |
| 2729 | static void alc_free(struct hda_codec *codec) |
| 2730 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2731 | struct alc_spec *spec = codec->spec; |
| 2732 | unsigned int i; |
| 2733 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2734 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2735 | return; |
| 2736 | |
| 2737 | if (spec->kctl_alloc) { |
| 2738 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2739 | kfree(spec->kctl_alloc[i].name); |
| 2740 | kfree(spec->kctl_alloc); |
| 2741 | } |
| 2742 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2743 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2744 | } |
| 2745 | |
| 2746 | /* |
| 2747 | */ |
| 2748 | static struct hda_codec_ops alc_patch_ops = { |
| 2749 | .build_controls = alc_build_controls, |
| 2750 | .build_pcms = alc_build_pcms, |
| 2751 | .init = alc_init, |
| 2752 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2753 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2754 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2755 | .check_power_status = alc_check_power_status, |
| 2756 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2757 | }; |
| 2758 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2759 | |
| 2760 | /* |
| 2761 | * Test configuration for debugging |
| 2762 | * |
| 2763 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2764 | * enum controls. |
| 2765 | */ |
| 2766 | #ifdef CONFIG_SND_DEBUG |
| 2767 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2768 | 0x02, 0x03, 0x04, 0x05 |
| 2769 | }; |
| 2770 | |
| 2771 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2772 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2773 | .items = { |
| 2774 | { "In-1", 0x0 }, |
| 2775 | { "In-2", 0x1 }, |
| 2776 | { "In-3", 0x2 }, |
| 2777 | { "In-4", 0x3 }, |
| 2778 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2779 | { "Front", 0x5 }, |
| 2780 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2781 | }, |
| 2782 | }; |
| 2783 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2784 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2785 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2786 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2787 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2788 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2789 | }; |
| 2790 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2791 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2792 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2793 | { |
| 2794 | static char *texts[] = { |
| 2795 | "N/A", "Line Out", "HP Out", |
| 2796 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2797 | }; |
| 2798 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2799 | uinfo->count = 1; |
| 2800 | uinfo->value.enumerated.items = 8; |
| 2801 | if (uinfo->value.enumerated.item >= 8) |
| 2802 | uinfo->value.enumerated.item = 7; |
| 2803 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2804 | return 0; |
| 2805 | } |
| 2806 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2807 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2808 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2809 | { |
| 2810 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2811 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2812 | unsigned int pin_ctl, item = 0; |
| 2813 | |
| 2814 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2815 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2816 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2817 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2818 | item = 2; |
| 2819 | else |
| 2820 | item = 1; |
| 2821 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2822 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2823 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2824 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2825 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2826 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2827 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2828 | } |
| 2829 | } |
| 2830 | ucontrol->value.enumerated.item[0] = item; |
| 2831 | return 0; |
| 2832 | } |
| 2833 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2834 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2835 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2836 | { |
| 2837 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2838 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2839 | static unsigned int ctls[] = { |
| 2840 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2841 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2842 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2843 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2844 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2845 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2846 | }; |
| 2847 | unsigned int old_ctl, new_ctl; |
| 2848 | |
| 2849 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2850 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2851 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2852 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2853 | int val; |
| 2854 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2855 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2856 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2857 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2858 | HDA_AMP_MUTE : 0; |
| 2859 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2860 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2861 | return 1; |
| 2862 | } |
| 2863 | return 0; |
| 2864 | } |
| 2865 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2866 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2867 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2868 | { |
| 2869 | static char *texts[] = { |
| 2870 | "Front", "Surround", "CLFE", "Side" |
| 2871 | }; |
| 2872 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2873 | uinfo->count = 1; |
| 2874 | uinfo->value.enumerated.items = 4; |
| 2875 | if (uinfo->value.enumerated.item >= 4) |
| 2876 | uinfo->value.enumerated.item = 3; |
| 2877 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2878 | return 0; |
| 2879 | } |
| 2880 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2881 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2882 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2883 | { |
| 2884 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2885 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2886 | unsigned int sel; |
| 2887 | |
| 2888 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2889 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2890 | return 0; |
| 2891 | } |
| 2892 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2893 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2894 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2895 | { |
| 2896 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2897 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2898 | unsigned int sel; |
| 2899 | |
| 2900 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2901 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2902 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2903 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2904 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2905 | return 1; |
| 2906 | } |
| 2907 | return 0; |
| 2908 | } |
| 2909 | |
| 2910 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2911 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2912 | .name = xname, \ |
| 2913 | .info = alc_test_pin_ctl_info, \ |
| 2914 | .get = alc_test_pin_ctl_get, \ |
| 2915 | .put = alc_test_pin_ctl_put, \ |
| 2916 | .private_value = nid \ |
| 2917 | } |
| 2918 | |
| 2919 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2920 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2921 | .name = xname, \ |
| 2922 | .info = alc_test_pin_src_info, \ |
| 2923 | .get = alc_test_pin_src_get, \ |
| 2924 | .put = alc_test_pin_src_put, \ |
| 2925 | .private_value = nid \ |
| 2926 | } |
| 2927 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2928 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2929 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2930 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2931 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2932 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2933 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2934 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2935 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2936 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2937 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2938 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2939 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2940 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2941 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2942 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2943 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2944 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2945 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2946 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2947 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2948 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2949 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2950 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2951 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2952 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2953 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2954 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2955 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2956 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2957 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2958 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2959 | { |
| 2960 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2961 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2962 | .info = alc_ch_mode_info, |
| 2963 | .get = alc_ch_mode_get, |
| 2964 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2965 | }, |
| 2966 | { } /* end */ |
| 2967 | }; |
| 2968 | |
| 2969 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2970 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2971 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2972 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2973 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2974 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2975 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2976 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2977 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2978 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2979 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2980 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2981 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2982 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2983 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2984 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2985 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2986 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2987 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2988 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2989 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2990 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2991 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2992 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2993 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2994 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2995 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2996 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2997 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2998 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2999 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3000 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3001 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3002 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3003 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3004 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3005 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3006 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3007 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3008 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3009 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3010 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3011 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3012 | /* Analog input/passthru */ |
| 3013 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3014 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3015 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3016 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3017 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3018 | { } |
| 3019 | }; |
| 3020 | #endif |
| 3021 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3022 | /* |
| 3023 | */ |
| 3024 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3025 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3026 | [ALC880_3ST] = "3stack", |
| 3027 | [ALC880_TCL_S700] = "tcl", |
| 3028 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3029 | [ALC880_CLEVO] = "clevo", |
| 3030 | [ALC880_5ST] = "5stack", |
| 3031 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3032 | [ALC880_W810] = "w810", |
| 3033 | [ALC880_Z71V] = "z71v", |
| 3034 | [ALC880_6ST] = "6stack", |
| 3035 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3036 | [ALC880_ASUS] = "asus", |
| 3037 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3038 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3039 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3040 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3041 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3042 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3043 | [ALC880_F1734] = "F1734", |
| 3044 | [ALC880_LG] = "lg", |
| 3045 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3046 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3047 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3048 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3049 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3050 | [ALC880_AUTO] = "auto", |
| 3051 | }; |
| 3052 | |
| 3053 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3054 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3055 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3056 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3057 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3058 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3059 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3060 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3061 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3062 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3063 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3064 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3065 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3066 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3067 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3068 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3069 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3070 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3071 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3072 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3073 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3074 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3075 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3076 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3077 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3078 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3079 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3080 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3081 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3082 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3083 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3084 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3085 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3086 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3087 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3088 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3089 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3090 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3091 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3092 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3093 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3094 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3095 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3096 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3097 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3098 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3099 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3100 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3101 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3102 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3103 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3104 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3105 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3106 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3107 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3108 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3109 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3110 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3111 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3112 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3113 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3114 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3115 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3116 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3117 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3118 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3119 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3120 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3121 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3122 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3123 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3124 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3125 | {} |
| 3126 | }; |
| 3127 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3128 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3129 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3130 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3131 | static struct alc_config_preset alc880_presets[] = { |
| 3132 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3133 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3134 | .init_verbs = { alc880_volume_init_verbs, |
| 3135 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3136 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3137 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3138 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3139 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3140 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3141 | .input_mux = &alc880_capture_source, |
| 3142 | }, |
| 3143 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3144 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3145 | .init_verbs = { alc880_volume_init_verbs, |
| 3146 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3147 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3148 | .dac_nids = alc880_dac_nids, |
| 3149 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3150 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3151 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3152 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3153 | .input_mux = &alc880_capture_source, |
| 3154 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3155 | [ALC880_TCL_S700] = { |
| 3156 | .mixers = { alc880_tcl_s700_mixer }, |
| 3157 | .init_verbs = { alc880_volume_init_verbs, |
| 3158 | alc880_pin_tcl_S700_init_verbs, |
| 3159 | alc880_gpio2_init_verbs }, |
| 3160 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3161 | .dac_nids = alc880_dac_nids, |
| 3162 | .hp_nid = 0x03, |
| 3163 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3164 | .channel_mode = alc880_2_jack_modes, |
| 3165 | .input_mux = &alc880_capture_source, |
| 3166 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3167 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3168 | .mixers = { alc880_three_stack_mixer, |
| 3169 | alc880_five_stack_mixer}, |
| 3170 | .init_verbs = { alc880_volume_init_verbs, |
| 3171 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3172 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3173 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3174 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3175 | .channel_mode = alc880_fivestack_modes, |
| 3176 | .input_mux = &alc880_capture_source, |
| 3177 | }, |
| 3178 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3179 | .mixers = { alc880_three_stack_mixer, |
| 3180 | alc880_five_stack_mixer }, |
| 3181 | .init_verbs = { alc880_volume_init_verbs, |
| 3182 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3183 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3184 | .dac_nids = alc880_dac_nids, |
| 3185 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3186 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3187 | .channel_mode = alc880_fivestack_modes, |
| 3188 | .input_mux = &alc880_capture_source, |
| 3189 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3190 | [ALC880_6ST] = { |
| 3191 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3192 | .init_verbs = { alc880_volume_init_verbs, |
| 3193 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3194 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3195 | .dac_nids = alc880_6st_dac_nids, |
| 3196 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3197 | .channel_mode = alc880_sixstack_modes, |
| 3198 | .input_mux = &alc880_6stack_capture_source, |
| 3199 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3200 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3201 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3202 | .init_verbs = { alc880_volume_init_verbs, |
| 3203 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3204 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3205 | .dac_nids = alc880_6st_dac_nids, |
| 3206 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3207 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3208 | .channel_mode = alc880_sixstack_modes, |
| 3209 | .input_mux = &alc880_6stack_capture_source, |
| 3210 | }, |
| 3211 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3212 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3213 | .init_verbs = { alc880_volume_init_verbs, |
| 3214 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3215 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3216 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3217 | .dac_nids = alc880_w810_dac_nids, |
| 3218 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3219 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3220 | .channel_mode = alc880_w810_modes, |
| 3221 | .input_mux = &alc880_capture_source, |
| 3222 | }, |
| 3223 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3224 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3225 | .init_verbs = { alc880_volume_init_verbs, |
| 3226 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3227 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3228 | .dac_nids = alc880_z71v_dac_nids, |
| 3229 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3230 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3231 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3232 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3233 | .input_mux = &alc880_capture_source, |
| 3234 | }, |
| 3235 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3236 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3237 | .init_verbs = { alc880_volume_init_verbs, |
| 3238 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3239 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3240 | .dac_nids = alc880_f1734_dac_nids, |
| 3241 | .hp_nid = 0x02, |
| 3242 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3243 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3244 | .input_mux = &alc880_f1734_capture_source, |
| 3245 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3246 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3247 | }, |
| 3248 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3249 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3250 | .init_verbs = { alc880_volume_init_verbs, |
| 3251 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3252 | alc880_gpio1_init_verbs }, |
| 3253 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3254 | .dac_nids = alc880_asus_dac_nids, |
| 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 | }, |
| 3260 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 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, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3264 | alc880_gpio1_init_verbs }, |
| 3265 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3266 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3267 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 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, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3271 | .input_mux = &alc880_capture_source, |
| 3272 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3273 | [ALC880_ASUS_DIG2] = { |
| 3274 | .mixers = { alc880_asus_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, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3277 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3278 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3279 | .dac_nids = alc880_asus_dac_nids, |
| 3280 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 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, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3284 | .input_mux = &alc880_capture_source, |
| 3285 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3286 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3287 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +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 | alc880_gpio1_init_verbs }, |
| 3291 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3292 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3293 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3294 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3295 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3296 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3297 | .input_mux = &alc880_capture_source, |
| 3298 | }, |
| 3299 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3300 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3301 | .init_verbs = { alc880_volume_init_verbs, |
| 3302 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3303 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3304 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3305 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3306 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3307 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3308 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3309 | .input_mux = &alc880_capture_source, |
| 3310 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3311 | [ALC880_UNIWILL] = { |
| 3312 | .mixers = { alc880_uniwill_mixer }, |
| 3313 | .init_verbs = { alc880_volume_init_verbs, |
| 3314 | alc880_uniwill_init_verbs }, |
| 3315 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3316 | .dac_nids = alc880_asus_dac_nids, |
| 3317 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3318 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3319 | .channel_mode = alc880_threestack_modes, |
| 3320 | .need_dac_fix = 1, |
| 3321 | .input_mux = &alc880_capture_source, |
| 3322 | .unsol_event = alc880_uniwill_unsol_event, |
| 3323 | .init_hook = alc880_uniwill_automute, |
| 3324 | }, |
| 3325 | [ALC880_UNIWILL_P53] = { |
| 3326 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3327 | .init_verbs = { alc880_volume_init_verbs, |
| 3328 | alc880_uniwill_p53_init_verbs }, |
| 3329 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3330 | .dac_nids = alc880_asus_dac_nids, |
| 3331 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3332 | .channel_mode = alc880_threestack_modes, |
| 3333 | .input_mux = &alc880_capture_source, |
| 3334 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3335 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3336 | }, |
| 3337 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3338 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3339 | alc880_pcbeep_mixer, }, |
| 3340 | .init_verbs = { alc880_volume_init_verbs, |
| 3341 | alc880_uniwill_p53_init_verbs, |
| 3342 | alc880_beep_init_verbs }, |
| 3343 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3344 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3345 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3346 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3347 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3348 | .input_mux = &alc880_capture_source, |
| 3349 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3350 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3351 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3352 | [ALC880_CLEVO] = { |
| 3353 | .mixers = { alc880_three_stack_mixer }, |
| 3354 | .init_verbs = { alc880_volume_init_verbs, |
| 3355 | alc880_pin_clevo_init_verbs }, |
| 3356 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3357 | .dac_nids = alc880_dac_nids, |
| 3358 | .hp_nid = 0x03, |
| 3359 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3360 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3361 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3362 | .input_mux = &alc880_capture_source, |
| 3363 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3364 | [ALC880_LG] = { |
| 3365 | .mixers = { alc880_lg_mixer }, |
| 3366 | .init_verbs = { alc880_volume_init_verbs, |
| 3367 | alc880_lg_init_verbs }, |
| 3368 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3369 | .dac_nids = alc880_lg_dac_nids, |
| 3370 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3371 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3372 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3373 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3374 | .input_mux = &alc880_lg_capture_source, |
| 3375 | .unsol_event = alc880_lg_unsol_event, |
| 3376 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3377 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3378 | .loopbacks = alc880_lg_loopbacks, |
| 3379 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3380 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3381 | [ALC880_LG_LW] = { |
| 3382 | .mixers = { alc880_lg_lw_mixer }, |
| 3383 | .init_verbs = { alc880_volume_init_verbs, |
| 3384 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3385 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3386 | .dac_nids = alc880_dac_nids, |
| 3387 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3388 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3389 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3390 | .input_mux = &alc880_lg_lw_capture_source, |
| 3391 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3392 | .init_hook = alc880_lg_lw_automute, |
| 3393 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3394 | [ALC880_MEDION_RIM] = { |
| 3395 | .mixers = { alc880_medion_rim_mixer }, |
| 3396 | .init_verbs = { alc880_volume_init_verbs, |
| 3397 | alc880_medion_rim_init_verbs, |
| 3398 | alc_gpio2_init_verbs }, |
| 3399 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3400 | .dac_nids = alc880_dac_nids, |
| 3401 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3402 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3403 | .channel_mode = alc880_2_jack_modes, |
| 3404 | .input_mux = &alc880_medion_rim_capture_source, |
| 3405 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3406 | .init_hook = alc880_medion_rim_automute, |
| 3407 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3408 | #ifdef CONFIG_SND_DEBUG |
| 3409 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3410 | .mixers = { alc880_test_mixer }, |
| 3411 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3412 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3413 | .dac_nids = alc880_test_dac_nids, |
| 3414 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3415 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3416 | .channel_mode = alc880_test_modes, |
| 3417 | .input_mux = &alc880_test_capture_source, |
| 3418 | }, |
| 3419 | #endif |
| 3420 | }; |
| 3421 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3422 | /* |
| 3423 | * Automatic parse of I/O pins from the BIOS configuration |
| 3424 | */ |
| 3425 | |
| 3426 | #define NUM_CONTROL_ALLOC 32 |
| 3427 | #define NUM_VERB_ALLOC 32 |
| 3428 | |
| 3429 | enum { |
| 3430 | ALC_CTL_WIDGET_VOL, |
| 3431 | ALC_CTL_WIDGET_MUTE, |
| 3432 | ALC_CTL_BIND_MUTE, |
| 3433 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3434 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3435 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3436 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3437 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3438 | }; |
| 3439 | |
| 3440 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3441 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3442 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3443 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3444 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3445 | |
| 3446 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3447 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3448 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3449 | /* array + terminator */ |
| 3450 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3451 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3452 | return -ENOMEM; |
| 3453 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3454 | memcpy(knew, spec->kctl_alloc, |
| 3455 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3456 | kfree(spec->kctl_alloc); |
| 3457 | } |
| 3458 | spec->kctl_alloc = knew; |
| 3459 | spec->num_kctl_alloc = num; |
| 3460 | } |
| 3461 | |
| 3462 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3463 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3464 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3465 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3466 | return -ENOMEM; |
| 3467 | knew->private_value = val; |
| 3468 | spec->num_kctl_used++; |
| 3469 | return 0; |
| 3470 | } |
| 3471 | |
| 3472 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3473 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3474 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3475 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3476 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3477 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3478 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3479 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3480 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3481 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3482 | #define ALC880_PIN_CD_NID 0x1c |
| 3483 | |
| 3484 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3485 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3486 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3487 | { |
| 3488 | hda_nid_t nid; |
| 3489 | int assigned[4]; |
| 3490 | int i, j; |
| 3491 | |
| 3492 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3493 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3494 | |
| 3495 | /* check the pins hardwired to audio widget */ |
| 3496 | for (i = 0; i < cfg->line_outs; i++) { |
| 3497 | nid = cfg->line_out_pins[i]; |
| 3498 | if (alc880_is_fixed_pin(nid)) { |
| 3499 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3500 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3501 | assigned[idx] = 1; |
| 3502 | } |
| 3503 | } |
| 3504 | /* left pins can be connect to any audio widget */ |
| 3505 | for (i = 0; i < cfg->line_outs; i++) { |
| 3506 | nid = cfg->line_out_pins[i]; |
| 3507 | if (alc880_is_fixed_pin(nid)) |
| 3508 | continue; |
| 3509 | /* search for an empty channel */ |
| 3510 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3511 | if (!assigned[j]) { |
| 3512 | spec->multiout.dac_nids[i] = |
| 3513 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3514 | assigned[j] = 1; |
| 3515 | break; |
| 3516 | } |
| 3517 | } |
| 3518 | } |
| 3519 | spec->multiout.num_dacs = cfg->line_outs; |
| 3520 | return 0; |
| 3521 | } |
| 3522 | |
| 3523 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3524 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3525 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3526 | { |
| 3527 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3528 | static const char *chname[4] = { |
| 3529 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3530 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3531 | hda_nid_t nid; |
| 3532 | int i, err; |
| 3533 | |
| 3534 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3535 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3536 | continue; |
| 3537 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3538 | if (i == 2) { |
| 3539 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3540 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3541 | "Center Playback Volume", |
| 3542 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3543 | HDA_OUTPUT)); |
| 3544 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3545 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3546 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3547 | "LFE Playback Volume", |
| 3548 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3549 | HDA_OUTPUT)); |
| 3550 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3551 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3552 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3553 | "Center Playback Switch", |
| 3554 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3555 | HDA_INPUT)); |
| 3556 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3557 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3558 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3559 | "LFE Playback Switch", |
| 3560 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3561 | HDA_INPUT)); |
| 3562 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3563 | return err; |
| 3564 | } else { |
| 3565 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3566 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3567 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3568 | HDA_OUTPUT)); |
| 3569 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3570 | return err; |
| 3571 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3572 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3573 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3574 | HDA_INPUT)); |
| 3575 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3576 | return err; |
| 3577 | } |
| 3578 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3579 | return 0; |
| 3580 | } |
| 3581 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3582 | /* add playback controls for speaker and HP outputs */ |
| 3583 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3584 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3585 | { |
| 3586 | hda_nid_t nid; |
| 3587 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3588 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3589 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3590 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3591 | return 0; |
| 3592 | |
| 3593 | if (alc880_is_fixed_pin(pin)) { |
| 3594 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3595 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3596 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3597 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3598 | else |
| 3599 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3600 | /* control HP volume/switch on the output mixer amp */ |
| 3601 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3602 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3603 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3604 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3605 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3606 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3607 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3608 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3609 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3610 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3611 | return err; |
| 3612 | } else if (alc880_is_multi_pin(pin)) { |
| 3613 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3614 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3615 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3616 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3617 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3618 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3619 | return err; |
| 3620 | } |
| 3621 | return 0; |
| 3622 | } |
| 3623 | |
| 3624 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3625 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3626 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3627 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3628 | { |
| 3629 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3630 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3631 | |
| 3632 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3633 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3634 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3635 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3636 | return err; |
| 3637 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3638 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3639 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3640 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3641 | return err; |
| 3642 | return 0; |
| 3643 | } |
| 3644 | |
| 3645 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3646 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3647 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3648 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3649 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3650 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3651 | |
| 3652 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3653 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3654 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3655 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3656 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3657 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3658 | if (err < 0) |
| 3659 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3660 | imux->items[imux->num_items].label = |
| 3661 | auto_pin_cfg_labels[i]; |
| 3662 | imux->items[imux->num_items].index = |
| 3663 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3664 | imux->num_items++; |
| 3665 | } |
| 3666 | } |
| 3667 | return 0; |
| 3668 | } |
| 3669 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3670 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3671 | unsigned int pin_type) |
| 3672 | { |
| 3673 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3674 | pin_type); |
| 3675 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3676 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3677 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3678 | } |
| 3679 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3680 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3681 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3682 | int dac_idx) |
| 3683 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3684 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3685 | /* need the manual connection? */ |
| 3686 | if (alc880_is_multi_pin(nid)) { |
| 3687 | struct alc_spec *spec = codec->spec; |
| 3688 | int idx = alc880_multi_pin_idx(nid); |
| 3689 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3690 | AC_VERB_SET_CONNECT_SEL, |
| 3691 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3692 | } |
| 3693 | } |
| 3694 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3695 | static int get_pin_type(int line_out_type) |
| 3696 | { |
| 3697 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3698 | return PIN_HP; |
| 3699 | else |
| 3700 | return PIN_OUT; |
| 3701 | } |
| 3702 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3703 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3704 | { |
| 3705 | struct alc_spec *spec = codec->spec; |
| 3706 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3707 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3708 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3709 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3710 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3711 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3712 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3713 | } |
| 3714 | } |
| 3715 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3716 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3717 | { |
| 3718 | struct alc_spec *spec = codec->spec; |
| 3719 | hda_nid_t pin; |
| 3720 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3721 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3722 | if (pin) /* connect to front */ |
| 3723 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3724 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3725 | if (pin) /* connect to front */ |
| 3726 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3727 | } |
| 3728 | |
| 3729 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3730 | { |
| 3731 | struct alc_spec *spec = codec->spec; |
| 3732 | int i; |
| 3733 | |
| 3734 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3735 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3736 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3737 | snd_hda_codec_write(codec, nid, 0, |
| 3738 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3739 | i <= AUTO_PIN_FRONT_MIC ? |
| 3740 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3741 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3742 | snd_hda_codec_write(codec, nid, 0, |
| 3743 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3744 | AMP_OUT_MUTE); |
| 3745 | } |
| 3746 | } |
| 3747 | } |
| 3748 | |
| 3749 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3750 | /* return 1 if successful, 0 if the proper config is not found, |
| 3751 | * or a negative error code |
| 3752 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3753 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3754 | { |
| 3755 | struct alc_spec *spec = codec->spec; |
| 3756 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3757 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3758 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3759 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3760 | alc880_ignore); |
| 3761 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3762 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3763 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3764 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3765 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3766 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3767 | if (err < 0) |
| 3768 | return err; |
| 3769 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3770 | if (err < 0) |
| 3771 | return err; |
| 3772 | err = alc880_auto_create_extra_out(spec, |
| 3773 | spec->autocfg.speaker_pins[0], |
| 3774 | "Speaker"); |
| 3775 | if (err < 0) |
| 3776 | return err; |
| 3777 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3778 | "Headphone"); |
| 3779 | if (err < 0) |
| 3780 | return err; |
| 3781 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3782 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3783 | return err; |
| 3784 | |
| 3785 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3786 | |
| 3787 | if (spec->autocfg.dig_out_pin) |
| 3788 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3789 | if (spec->autocfg.dig_in_pin) |
| 3790 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3791 | |
| 3792 | if (spec->kctl_alloc) |
| 3793 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3794 | |
| 3795 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3796 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3797 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3798 | spec->input_mux = &spec->private_imux; |
| 3799 | |
| 3800 | return 1; |
| 3801 | } |
| 3802 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3803 | /* additional initialization for auto-configuration model */ |
| 3804 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3805 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3806 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3807 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3808 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3809 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3810 | if (spec->unsol_event) |
| 3811 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3812 | } |
| 3813 | |
| 3814 | /* |
| 3815 | * OK, here we have finally the patch for ALC880 |
| 3816 | */ |
| 3817 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3818 | static int patch_alc880(struct hda_codec *codec) |
| 3819 | { |
| 3820 | struct alc_spec *spec; |
| 3821 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3822 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3823 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3824 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3825 | if (spec == NULL) |
| 3826 | return -ENOMEM; |
| 3827 | |
| 3828 | codec->spec = spec; |
| 3829 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3830 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3831 | alc880_models, |
| 3832 | alc880_cfg_tbl); |
| 3833 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3834 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3835 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3836 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3837 | } |
| 3838 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3839 | if (board_config == ALC880_AUTO) { |
| 3840 | /* automatic parse from the BIOS config */ |
| 3841 | err = alc880_parse_auto_config(codec); |
| 3842 | if (err < 0) { |
| 3843 | alc_free(codec); |
| 3844 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3845 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3846 | printk(KERN_INFO |
| 3847 | "hda_codec: Cannot set up configuration " |
| 3848 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3849 | board_config = ALC880_3ST; |
| 3850 | } |
| 3851 | } |
| 3852 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3853 | if (board_config != ALC880_AUTO) |
| 3854 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3855 | |
| 3856 | spec->stream_name_analog = "ALC880 Analog"; |
| 3857 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3858 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3859 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3860 | |
| 3861 | spec->stream_name_digital = "ALC880 Digital"; |
| 3862 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3863 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3864 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3865 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3866 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3867 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3868 | /* get type */ |
| 3869 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3870 | if (wcap != AC_WID_AUD_IN) { |
| 3871 | spec->adc_nids = alc880_adc_nids_alt; |
| 3872 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3873 | spec->mixers[spec->num_mixers] = |
| 3874 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3875 | spec->num_mixers++; |
| 3876 | } else { |
| 3877 | spec->adc_nids = alc880_adc_nids; |
| 3878 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3879 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3880 | spec->num_mixers++; |
| 3881 | } |
| 3882 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3883 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3884 | spec->vmaster_nid = 0x0c; |
| 3885 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3886 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3887 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3888 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3889 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3890 | if (!spec->loopback.amplist) |
| 3891 | spec->loopback.amplist = alc880_loopbacks; |
| 3892 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3893 | |
| 3894 | return 0; |
| 3895 | } |
| 3896 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3897 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3898 | /* |
| 3899 | * ALC260 support |
| 3900 | */ |
| 3901 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3902 | static hda_nid_t alc260_dac_nids[1] = { |
| 3903 | /* front */ |
| 3904 | 0x02, |
| 3905 | }; |
| 3906 | |
| 3907 | static hda_nid_t alc260_adc_nids[1] = { |
| 3908 | /* ADC0 */ |
| 3909 | 0x04, |
| 3910 | }; |
| 3911 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3912 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3913 | /* ADC1 */ |
| 3914 | 0x05, |
| 3915 | }; |
| 3916 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3917 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3918 | /* ADC1, 0 */ |
| 3919 | 0x05, 0x04 |
| 3920 | }; |
| 3921 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3922 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3923 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3924 | */ |
| 3925 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3926 | /* ADC0, ADC1 */ |
| 3927 | 0x04, 0x05 |
| 3928 | }; |
| 3929 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3930 | #define ALC260_DIGOUT_NID 0x03 |
| 3931 | #define ALC260_DIGIN_NID 0x06 |
| 3932 | |
| 3933 | static struct hda_input_mux alc260_capture_source = { |
| 3934 | .num_items = 4, |
| 3935 | .items = { |
| 3936 | { "Mic", 0x0 }, |
| 3937 | { "Front Mic", 0x1 }, |
| 3938 | { "Line", 0x2 }, |
| 3939 | { "CD", 0x4 }, |
| 3940 | }, |
| 3941 | }; |
| 3942 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3943 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3944 | * headphone jack and the internal CD lines since these are the only pins at |
| 3945 | * which audio can appear. For flexibility, also allow the option of |
| 3946 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3947 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3948 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3949 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3950 | { |
| 3951 | .num_items = 3, |
| 3952 | .items = { |
| 3953 | { "Mic/Line", 0x0 }, |
| 3954 | { "CD", 0x4 }, |
| 3955 | { "Headphone", 0x2 }, |
| 3956 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3957 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3958 | { |
| 3959 | .num_items = 4, |
| 3960 | .items = { |
| 3961 | { "Mic/Line", 0x0 }, |
| 3962 | { "CD", 0x4 }, |
| 3963 | { "Headphone", 0x2 }, |
| 3964 | { "Mixer", 0x5 }, |
| 3965 | }, |
| 3966 | }, |
| 3967 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3968 | }; |
| 3969 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3970 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3971 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3972 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3973 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3974 | { |
| 3975 | .num_items = 4, |
| 3976 | .items = { |
| 3977 | { "Mic", 0x0 }, |
| 3978 | { "Line", 0x2 }, |
| 3979 | { "CD", 0x4 }, |
| 3980 | { "Headphone", 0x5 }, |
| 3981 | }, |
| 3982 | }, |
| 3983 | { |
| 3984 | .num_items = 5, |
| 3985 | .items = { |
| 3986 | { "Mic", 0x0 }, |
| 3987 | { "Line", 0x2 }, |
| 3988 | { "CD", 0x4 }, |
| 3989 | { "Headphone", 0x6 }, |
| 3990 | { "Mixer", 0x5 }, |
| 3991 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3992 | }, |
| 3993 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3994 | /* |
| 3995 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3996 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3997 | * element which allows changing the channel mode, so the verb list is |
| 3998 | * never used. |
| 3999 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4000 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4001 | { 2, NULL }, |
| 4002 | }; |
| 4003 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4004 | |
| 4005 | /* Mixer combinations |
| 4006 | * |
| 4007 | * basic: base_output + input + pc_beep + capture |
| 4008 | * HP: base_output + input + capture_alt |
| 4009 | * HP_3013: hp_3013 + input + capture |
| 4010 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4011 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4012 | */ |
| 4013 | |
| 4014 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4015 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4016 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4017 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4018 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4019 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4020 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4021 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4022 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4023 | |
| 4024 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4025 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4026 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4027 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4028 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4029 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4030 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4031 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4032 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4033 | { } /* end */ |
| 4034 | }; |
| 4035 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4036 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 4037 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4038 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4039 | { } /* end */ |
| 4040 | }; |
| 4041 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4042 | /* update HP, line and mono out pins according to the master switch */ |
| 4043 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4044 | hda_nid_t hp, hda_nid_t line, |
| 4045 | hda_nid_t mono) |
| 4046 | { |
| 4047 | struct alc_spec *spec = codec->spec; |
| 4048 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4049 | /* change HP and line-out pins */ |
| 4050 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4051 | val); |
| 4052 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4053 | val); |
| 4054 | /* mono (speaker) depending on the HP jack sense */ |
| 4055 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 4056 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4057 | val); |
| 4058 | } |
| 4059 | |
| 4060 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4061 | struct snd_ctl_elem_value *ucontrol) |
| 4062 | { |
| 4063 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4064 | struct alc_spec *spec = codec->spec; |
| 4065 | *ucontrol->value.integer.value = spec->master_sw; |
| 4066 | return 0; |
| 4067 | } |
| 4068 | |
| 4069 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4070 | struct snd_ctl_elem_value *ucontrol) |
| 4071 | { |
| 4072 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4073 | struct alc_spec *spec = codec->spec; |
| 4074 | int val = !!*ucontrol->value.integer.value; |
| 4075 | hda_nid_t hp, line, mono; |
| 4076 | |
| 4077 | if (val == spec->master_sw) |
| 4078 | return 0; |
| 4079 | spec->master_sw = val; |
| 4080 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4081 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4082 | mono = kcontrol->private_value & 0xff; |
| 4083 | alc260_hp_master_update(codec, hp, line, mono); |
| 4084 | return 1; |
| 4085 | } |
| 4086 | |
| 4087 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4088 | { |
| 4089 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4090 | .name = "Master Playback Switch", |
| 4091 | .info = snd_ctl_boolean_mono_info, |
| 4092 | .get = alc260_hp_master_sw_get, |
| 4093 | .put = alc260_hp_master_sw_put, |
| 4094 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4095 | }, |
| 4096 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4097 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4098 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4099 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4100 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4101 | HDA_OUTPUT), |
| 4102 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4103 | { } /* end */ |
| 4104 | }; |
| 4105 | |
| 4106 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4107 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4108 | {}, |
| 4109 | }; |
| 4110 | |
| 4111 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4112 | { |
| 4113 | struct alc_spec *spec = codec->spec; |
| 4114 | unsigned int present; |
| 4115 | |
| 4116 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4117 | AC_VERB_GET_PIN_SENSE, 0); |
| 4118 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4119 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4120 | } |
| 4121 | |
| 4122 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4123 | { |
| 4124 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4125 | alc260_hp_automute(codec); |
| 4126 | } |
| 4127 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4128 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4129 | { |
| 4130 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4131 | .name = "Master Playback Switch", |
| 4132 | .info = snd_ctl_boolean_mono_info, |
| 4133 | .get = alc260_hp_master_sw_get, |
| 4134 | .put = alc260_hp_master_sw_put, |
| 4135 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 4136 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4137 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4138 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4139 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4140 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4141 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4142 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4143 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4144 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4145 | { } /* end */ |
| 4146 | }; |
| 4147 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4148 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4149 | .ops = &snd_hda_bind_vol, |
| 4150 | .values = { |
| 4151 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4152 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4153 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4154 | 0 |
| 4155 | }, |
| 4156 | }; |
| 4157 | |
| 4158 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4159 | .ops = &snd_hda_bind_sw, |
| 4160 | .values = { |
| 4161 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4162 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4163 | 0 |
| 4164 | }, |
| 4165 | }; |
| 4166 | |
| 4167 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4168 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4169 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4170 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4171 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4172 | { } /* end */ |
| 4173 | }; |
| 4174 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4175 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4176 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4177 | {}, |
| 4178 | }; |
| 4179 | |
| 4180 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4181 | { |
| 4182 | struct alc_spec *spec = codec->spec; |
| 4183 | unsigned int present; |
| 4184 | |
| 4185 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4186 | AC_VERB_GET_PIN_SENSE, 0); |
| 4187 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4188 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 4189 | } |
| 4190 | |
| 4191 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4192 | unsigned int res) |
| 4193 | { |
| 4194 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4195 | alc260_hp_3013_automute(codec); |
| 4196 | } |
| 4197 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4198 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4199 | { |
| 4200 | unsigned int present, bits; |
| 4201 | |
| 4202 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4203 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4204 | |
| 4205 | bits = present ? 0 : PIN_OUT; |
| 4206 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4207 | bits); |
| 4208 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4209 | bits); |
| 4210 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4211 | bits); |
| 4212 | } |
| 4213 | |
| 4214 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4215 | unsigned int res) |
| 4216 | { |
| 4217 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4218 | alc260_hp_3012_automute(codec); |
| 4219 | } |
| 4220 | |
| 4221 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4222 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4223 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4224 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4225 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4226 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4227 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4228 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4229 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4230 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4231 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4232 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4233 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4234 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4235 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4236 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4237 | { } /* end */ |
| 4238 | }; |
| 4239 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4240 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4241 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4242 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4243 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4244 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4245 | * revisions available in early 2006. Therefore for now allow the |
| 4246 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4247 | * that the lack of mic bias for this NID is intentional we could change the |
| 4248 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4249 | * |
| 4250 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4251 | * don't appear to make the mic bias available from the "line" jack, even |
| 4252 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4253 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4254 | * and the output jack. If this turns out to be the case for all such |
| 4255 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4256 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4257 | * |
| 4258 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4259 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4260 | * controls for such models. On models without a "mono speaker" the control |
| 4261 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4262 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4263 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4264 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4265 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4266 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4267 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4268 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4269 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4270 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4271 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4272 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4273 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4274 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4275 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4276 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4277 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4278 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4279 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4280 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4281 | { } /* end */ |
| 4282 | }; |
| 4283 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4284 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4285 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4286 | */ |
| 4287 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4288 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4289 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4290 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4291 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4292 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4293 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4294 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4295 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4296 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4297 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4298 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4299 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4300 | { } /* end */ |
| 4301 | }; |
| 4302 | |
| 4303 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4304 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4305 | */ |
| 4306 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4307 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4308 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4309 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4310 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4311 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4312 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4313 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4314 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4315 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4316 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4317 | { } /* end */ |
| 4318 | }; |
| 4319 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4320 | /* capture mixer elements */ |
| 4321 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4322 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4323 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4324 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4325 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4326 | { |
| 4327 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4328 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4329 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4330 | */ |
| 4331 | /* .name = "Capture Source", */ |
| 4332 | .name = "Input Source", |
| 4333 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4334 | .info = alc_mux_enum_info, |
| 4335 | .get = alc_mux_enum_get, |
| 4336 | .put = alc_mux_enum_put, |
| 4337 | }, |
| 4338 | { } /* end */ |
| 4339 | }; |
| 4340 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4341 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4342 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4343 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4344 | { |
| 4345 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4346 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4347 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4348 | */ |
| 4349 | /* .name = "Capture Source", */ |
| 4350 | .name = "Input Source", |
| 4351 | .count = 1, |
| 4352 | .info = alc_mux_enum_info, |
| 4353 | .get = alc_mux_enum_get, |
| 4354 | .put = alc_mux_enum_put, |
| 4355 | }, |
| 4356 | { } /* end */ |
| 4357 | }; |
| 4358 | |
| 4359 | /* |
| 4360 | * initialization verbs |
| 4361 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4362 | static struct hda_verb alc260_init_verbs[] = { |
| 4363 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4365 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4366 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4367 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4368 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4369 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4370 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4371 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4372 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4373 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4374 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4375 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4376 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4377 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4378 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4379 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4380 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4381 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4382 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4383 | /* set connection select to line in (default select for this ADC) */ |
| 4384 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4385 | /* mute capture amp left and right */ |
| 4386 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4387 | /* set connection select to line in (default select for this ADC) */ |
| 4388 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4389 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4390 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4391 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4392 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4393 | /* set vol=0 HP mixer amp left and right */ |
| 4394 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4395 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4396 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4397 | /* set vol=0 Mono mixer amp left and right */ |
| 4398 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4399 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4400 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4401 | /* unmute LINE-2 out pin */ |
| 4402 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4403 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4404 | * Line In 2 = 0x03 |
| 4405 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4406 | /* mute analog inputs */ |
| 4407 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4408 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4409 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4410 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4411 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4412 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4413 | /* mute Front out path */ |
| 4414 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4415 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4416 | /* mute Headphone out path */ |
| 4417 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4418 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4419 | /* mute Mono out path */ |
| 4420 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4421 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4422 | { } |
| 4423 | }; |
| 4424 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4425 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4426 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4427 | /* Headphone and output */ |
| 4428 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4429 | /* mono output */ |
| 4430 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4431 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4432 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4433 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4434 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4435 | /* Line In pin widget for input */ |
| 4436 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4437 | /* Line-2 pin widget for output */ |
| 4438 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4439 | /* CD pin widget for input */ |
| 4440 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4441 | /* unmute amp left and right */ |
| 4442 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4443 | /* set connection select to line in (default select for this ADC) */ |
| 4444 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4445 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4447 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4449 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4450 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4451 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4452 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4453 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4454 | * Line In 2 = 0x03 |
| 4455 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4456 | /* mute analog inputs */ |
| 4457 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4462 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4463 | /* Unmute Front out path */ |
| 4464 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4465 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4466 | /* Unmute Headphone out path */ |
| 4467 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4468 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4469 | /* Unmute Mono out path */ |
| 4470 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4471 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4472 | { } |
| 4473 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4474 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4475 | |
| 4476 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4477 | /* Line out and output */ |
| 4478 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4479 | /* mono output */ |
| 4480 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4481 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4482 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4483 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4484 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4485 | /* Line In pin widget for input */ |
| 4486 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4487 | /* Headphone pin widget for output */ |
| 4488 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4489 | /* CD pin widget for input */ |
| 4490 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4491 | /* unmute amp left and right */ |
| 4492 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4493 | /* set connection select to line in (default select for this ADC) */ |
| 4494 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4495 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4496 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4497 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4498 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4499 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4500 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4501 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4502 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4503 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4504 | * Line In 2 = 0x03 |
| 4505 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4506 | /* mute analog inputs */ |
| 4507 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4508 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4509 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4510 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4511 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4512 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4513 | /* Unmute Front out path */ |
| 4514 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4515 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4516 | /* Unmute Headphone out path */ |
| 4517 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4518 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4519 | /* Unmute Mono out path */ |
| 4520 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4521 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4522 | { } |
| 4523 | }; |
| 4524 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4525 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4526 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4527 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4528 | */ |
| 4529 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4530 | /* Disable all GPIOs */ |
| 4531 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4532 | /* Internal speaker is connected to headphone pin */ |
| 4533 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4534 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4535 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4536 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4537 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4538 | /* Ensure all other unused pins are disabled and muted. */ |
| 4539 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4540 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4541 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4542 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4543 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4544 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4545 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4546 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4547 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4548 | /* Disable digital (SPDIF) pins */ |
| 4549 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4550 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4551 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4552 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4553 | * when acting as an output. |
| 4554 | */ |
| 4555 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4556 | |
| 4557 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4558 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4559 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4560 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4561 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4562 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4563 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4564 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4565 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4566 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4567 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4568 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4569 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4570 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4571 | * If the pin mode is changed by the user the pin mode control will |
| 4572 | * take care of enabling the pin's input/output buffers as needed. |
| 4573 | * Therefore there's no need to enable the input buffer at this |
| 4574 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4575 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4577 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4578 | * mixer ctrl) |
| 4579 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4580 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4581 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4582 | /* Mute capture amp left and right */ |
| 4583 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4584 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4585 | * in (on mic1 pin) |
| 4586 | */ |
| 4587 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4588 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4589 | /* Do the same for the second ADC: mute capture input amp and |
| 4590 | * set ADC connection to line in (on mic1 pin) |
| 4591 | */ |
| 4592 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4593 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4594 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4595 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4596 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4597 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4598 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4599 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4600 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4601 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4602 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4603 | {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] | 4604 | |
| 4605 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4606 | }; |
| 4607 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4608 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4609 | * similar laptops (adapted from Fujitsu init verbs). |
| 4610 | */ |
| 4611 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4612 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4613 | * the headphone jack. Turn this on and rely on the standard mute |
| 4614 | * methods whenever the user wants to turn these outputs off. |
| 4615 | */ |
| 4616 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4617 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4618 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4619 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4620 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4621 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4622 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4623 | /* Line In jack is connected to Line1 pin */ |
| 4624 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4625 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4626 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4627 | /* Ensure all other unused pins are disabled and muted. */ |
| 4628 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4629 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4630 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4631 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4632 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4633 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4634 | /* Disable digital (SPDIF) pins */ |
| 4635 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4636 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4637 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4638 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4639 | * bus when acting as outputs. |
| 4640 | */ |
| 4641 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4642 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4643 | |
| 4644 | /* Start with output sum widgets muted and their output gains at min */ |
| 4645 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4646 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4647 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4648 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4649 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4650 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4651 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4652 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4653 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4654 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4655 | /* Unmute Line-out pin widget amp left and right |
| 4656 | * (no equiv mixer ctrl) |
| 4657 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4658 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4659 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4660 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4661 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4662 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4663 | * will take care of enabling the pin's input/output buffers as needed. |
| 4664 | * Therefore there's no need to enable the input buffer at this |
| 4665 | * stage. |
| 4666 | */ |
| 4667 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4668 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4669 | |
| 4670 | /* Mute capture amp left and right */ |
| 4671 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4672 | /* Set ADC connection select to match default mixer setting - mic |
| 4673 | * (on mic1 pin) |
| 4674 | */ |
| 4675 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4676 | |
| 4677 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4678 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4679 | */ |
| 4680 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4681 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4682 | |
| 4683 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4684 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4685 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4686 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4687 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4688 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4689 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4690 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4691 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4692 | |
| 4693 | { } |
| 4694 | }; |
| 4695 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4696 | static struct hda_verb alc260_will_verbs[] = { |
| 4697 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4698 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4699 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4700 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4701 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4702 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4703 | {} |
| 4704 | }; |
| 4705 | |
| 4706 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4707 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4708 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4709 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4710 | |
| 4711 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4712 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4713 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4714 | |
| 4715 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4716 | {} |
| 4717 | }; |
| 4718 | |
| 4719 | /* toggle speaker-output according to the hp-jack state */ |
| 4720 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4721 | { |
| 4722 | unsigned int present; |
| 4723 | |
| 4724 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4725 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4726 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4727 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4728 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4729 | AC_VERB_SET_GPIO_DATA, 1); |
| 4730 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4731 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4732 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4733 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4734 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4735 | AC_VERB_SET_GPIO_DATA, 0); |
| 4736 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4737 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4738 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4739 | } |
| 4740 | } |
| 4741 | |
| 4742 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4743 | unsigned int res) |
| 4744 | { |
| 4745 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4746 | alc260_replacer_672v_automute(codec); |
| 4747 | } |
| 4748 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4749 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 4750 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4751 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4752 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4753 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4754 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4755 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4756 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4757 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4758 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4759 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4760 | {} |
| 4761 | }; |
| 4762 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4763 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4764 | * configuration. |
| 4765 | */ |
| 4766 | #ifdef CONFIG_SND_DEBUG |
| 4767 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4768 | 0x02, |
| 4769 | }; |
| 4770 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4771 | 0x04, 0x05, |
| 4772 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4773 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4774 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4775 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4776 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4777 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4778 | { |
| 4779 | .num_items = 7, |
| 4780 | .items = { |
| 4781 | { "MIC1 pin", 0x0 }, |
| 4782 | { "MIC2 pin", 0x1 }, |
| 4783 | { "LINE1 pin", 0x2 }, |
| 4784 | { "LINE2 pin", 0x3 }, |
| 4785 | { "CD pin", 0x4 }, |
| 4786 | { "LINE-OUT pin", 0x5 }, |
| 4787 | { "HP-OUT pin", 0x6 }, |
| 4788 | }, |
| 4789 | }, |
| 4790 | { |
| 4791 | .num_items = 8, |
| 4792 | .items = { |
| 4793 | { "MIC1 pin", 0x0 }, |
| 4794 | { "MIC2 pin", 0x1 }, |
| 4795 | { "LINE1 pin", 0x2 }, |
| 4796 | { "LINE2 pin", 0x3 }, |
| 4797 | { "CD pin", 0x4 }, |
| 4798 | { "Mixer", 0x5 }, |
| 4799 | { "LINE-OUT pin", 0x6 }, |
| 4800 | { "HP-OUT pin", 0x7 }, |
| 4801 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4802 | }, |
| 4803 | }; |
| 4804 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4805 | /* Output driver widgets */ |
| 4806 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4807 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4808 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4809 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4810 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4811 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4812 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4813 | /* Modes for retasking pin widgets |
| 4814 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4815 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4816 | * mention this restriction. At this stage it's not clear whether |
| 4817 | * this behaviour is intentional or is a hardware bug in chip |
| 4818 | * revisions available at least up until early 2006. Therefore for |
| 4819 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4820 | * choices, but if it turns out that the lack of mic bias for these |
| 4821 | * NIDs is intentional we could change their modes from |
| 4822 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4823 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4824 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4825 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4826 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4827 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4828 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4829 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4830 | |
| 4831 | /* Loopback mixer controls */ |
| 4832 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4833 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4834 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4835 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4836 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4837 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4838 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4839 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4840 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4841 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4842 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4843 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4844 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4845 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4846 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4847 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4848 | |
| 4849 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4850 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4851 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4852 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4853 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4854 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4855 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4856 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4857 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4858 | */ |
| 4859 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4860 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4861 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4862 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4863 | * this output to turn on an external amplifier. |
| 4864 | */ |
| 4865 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4866 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4867 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4868 | { } /* end */ |
| 4869 | }; |
| 4870 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4871 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4872 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4873 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4874 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4875 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4876 | /* Enable retasking pins as output, initially without power amp */ |
| 4877 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4878 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4879 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4880 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4881 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4882 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4883 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4884 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4885 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4886 | * payload also sets the generation to 0, output to be in "consumer" |
| 4887 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4888 | * control. |
| 4889 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4890 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4891 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4892 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4893 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4894 | * OUT1 sum bus when acting as an output. |
| 4895 | */ |
| 4896 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4897 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4898 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4899 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4900 | |
| 4901 | /* Start with output sum widgets muted and their output gains at min */ |
| 4902 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4903 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4904 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4905 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4906 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4907 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4908 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4909 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4910 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4911 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4912 | /* Unmute retasking pin widget output buffers since the default |
| 4913 | * state appears to be output. As the pin mode is changed by the |
| 4914 | * user the pin mode control will take care of enabling the pin's |
| 4915 | * input/output buffers as needed. |
| 4916 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4917 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4918 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4919 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4920 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4921 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4922 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4923 | /* Also unmute the mono-out pin widget */ |
| 4924 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4925 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4926 | /* Mute capture amp left and right */ |
| 4927 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4928 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4929 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4930 | */ |
| 4931 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4932 | |
| 4933 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4934 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4935 | */ |
| 4936 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4937 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4938 | |
| 4939 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4940 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4941 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4942 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4943 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4944 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4945 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4946 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4947 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4948 | |
| 4949 | { } |
| 4950 | }; |
| 4951 | #endif |
| 4952 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4953 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4954 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4955 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4956 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4957 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4958 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4959 | /* |
| 4960 | * for BIOS auto-configuration |
| 4961 | */ |
| 4962 | |
| 4963 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4964 | const char *pfx) |
| 4965 | { |
| 4966 | hda_nid_t nid_vol; |
| 4967 | unsigned long vol_val, sw_val; |
| 4968 | char name[32]; |
| 4969 | int err; |
| 4970 | |
| 4971 | if (nid >= 0x0f && nid < 0x11) { |
| 4972 | nid_vol = nid - 0x7; |
| 4973 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4974 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4975 | } else if (nid == 0x11) { |
| 4976 | nid_vol = nid - 0x7; |
| 4977 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4978 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4979 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4980 | nid_vol = 0x08; |
| 4981 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4982 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4983 | } else |
| 4984 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4985 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4986 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4987 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4988 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4989 | return err; |
| 4990 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4991 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4992 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4993 | return err; |
| 4994 | return 1; |
| 4995 | } |
| 4996 | |
| 4997 | /* add playback controls from the parsed DAC table */ |
| 4998 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4999 | const struct auto_pin_cfg *cfg) |
| 5000 | { |
| 5001 | hda_nid_t nid; |
| 5002 | int err; |
| 5003 | |
| 5004 | spec->multiout.num_dacs = 1; |
| 5005 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5006 | spec->multiout.dac_nids[0] = 0x02; |
| 5007 | |
| 5008 | nid = cfg->line_out_pins[0]; |
| 5009 | if (nid) { |
| 5010 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 5011 | if (err < 0) |
| 5012 | return err; |
| 5013 | } |
| 5014 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5015 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5016 | if (nid) { |
| 5017 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 5018 | if (err < 0) |
| 5019 | return err; |
| 5020 | } |
| 5021 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5022 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5023 | if (nid) { |
| 5024 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 5025 | if (err < 0) |
| 5026 | return err; |
| 5027 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5028 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5029 | } |
| 5030 | |
| 5031 | /* create playback/capture controls for input pins */ |
| 5032 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5033 | const struct auto_pin_cfg *cfg) |
| 5034 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5035 | struct hda_input_mux *imux = &spec->private_imux; |
| 5036 | int i, err, idx; |
| 5037 | |
| 5038 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5039 | if (cfg->input_pins[i] >= 0x12) { |
| 5040 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5041 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5042 | auto_pin_cfg_labels[i], idx, |
| 5043 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5044 | if (err < 0) |
| 5045 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5046 | imux->items[imux->num_items].label = |
| 5047 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5048 | imux->items[imux->num_items].index = idx; |
| 5049 | imux->num_items++; |
| 5050 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5051 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5052 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5053 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5054 | auto_pin_cfg_labels[i], idx, |
| 5055 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5056 | if (err < 0) |
| 5057 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5058 | imux->items[imux->num_items].label = |
| 5059 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5060 | imux->items[imux->num_items].index = idx; |
| 5061 | imux->num_items++; |
| 5062 | } |
| 5063 | } |
| 5064 | return 0; |
| 5065 | } |
| 5066 | |
| 5067 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5068 | hda_nid_t nid, int pin_type, |
| 5069 | int sel_idx) |
| 5070 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5071 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5072 | /* need the manual connection? */ |
| 5073 | if (nid >= 0x12) { |
| 5074 | int idx = nid - 0x12; |
| 5075 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5076 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5077 | } |
| 5078 | } |
| 5079 | |
| 5080 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5081 | { |
| 5082 | struct alc_spec *spec = codec->spec; |
| 5083 | hda_nid_t nid; |
| 5084 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5085 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5086 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5087 | if (nid) { |
| 5088 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5089 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5090 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5091 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5092 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5093 | if (nid) |
| 5094 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5095 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5096 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5097 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5098 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5099 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5100 | |
| 5101 | #define ALC260_PIN_CD_NID 0x16 |
| 5102 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5103 | { |
| 5104 | struct alc_spec *spec = codec->spec; |
| 5105 | int i; |
| 5106 | |
| 5107 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5108 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5109 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5110 | snd_hda_codec_write(codec, nid, 0, |
| 5111 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5112 | i <= AUTO_PIN_FRONT_MIC ? |
| 5113 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5114 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5115 | snd_hda_codec_write(codec, nid, 0, |
| 5116 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5117 | AMP_OUT_MUTE); |
| 5118 | } |
| 5119 | } |
| 5120 | } |
| 5121 | |
| 5122 | /* |
| 5123 | * generic initialization of ADC, input mixers and output mixers |
| 5124 | */ |
| 5125 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5126 | /* |
| 5127 | * Unmute ADC0-1 and set the default input to mic-in |
| 5128 | */ |
| 5129 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5130 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5131 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5132 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5133 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5134 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5135 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5136 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5137 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5138 | */ |
| 5139 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5140 | /* mute analog inputs */ |
| 5141 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5142 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5143 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5144 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5145 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5146 | |
| 5147 | /* |
| 5148 | * Set up output mixers (0x08 - 0x0a) |
| 5149 | */ |
| 5150 | /* set vol=0 to output mixers */ |
| 5151 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5152 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5153 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5154 | /* set up input amps for analog loopback */ |
| 5155 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5156 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5157 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5158 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5159 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5160 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5161 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5162 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5163 | { } |
| 5164 | }; |
| 5165 | |
| 5166 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5167 | { |
| 5168 | struct alc_spec *spec = codec->spec; |
| 5169 | unsigned int wcap; |
| 5170 | int err; |
| 5171 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5172 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5173 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5174 | alc260_ignore); |
| 5175 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5176 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5177 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5178 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5179 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5180 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5181 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5182 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5183 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5184 | return err; |
| 5185 | |
| 5186 | spec->multiout.max_channels = 2; |
| 5187 | |
| 5188 | if (spec->autocfg.dig_out_pin) |
| 5189 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 5190 | if (spec->kctl_alloc) |
| 5191 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 5192 | |
| 5193 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 5194 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5195 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5196 | spec->input_mux = &spec->private_imux; |
| 5197 | |
| 5198 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5199 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5200 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 5201 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5202 | spec->adc_nids = alc260_adc_nids_alt; |
| 5203 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5204 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5205 | } else { |
| 5206 | spec->adc_nids = alc260_adc_nids; |
| 5207 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5208 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5209 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5210 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5211 | |
| 5212 | return 1; |
| 5213 | } |
| 5214 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5215 | /* additional initialization for auto-configuration model */ |
| 5216 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5217 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5218 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5219 | alc260_auto_init_multi_out(codec); |
| 5220 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5221 | if (spec->unsol_event) |
| 5222 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5223 | } |
| 5224 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5225 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5226 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5227 | { 0x07, HDA_INPUT, 0 }, |
| 5228 | { 0x07, HDA_INPUT, 1 }, |
| 5229 | { 0x07, HDA_INPUT, 2 }, |
| 5230 | { 0x07, HDA_INPUT, 3 }, |
| 5231 | { 0x07, HDA_INPUT, 4 }, |
| 5232 | { } /* end */ |
| 5233 | }; |
| 5234 | #endif |
| 5235 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5236 | /* |
| 5237 | * ALC260 configurations |
| 5238 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5239 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5240 | [ALC260_BASIC] = "basic", |
| 5241 | [ALC260_HP] = "hp", |
| 5242 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5243 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5244 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5245 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5246 | [ALC260_WILL] = "will", |
| 5247 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5248 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5249 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5250 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5251 | [ALC260_AUTO] = "auto", |
| 5252 | }; |
| 5253 | |
| 5254 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5255 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5256 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5257 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5258 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5259 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5260 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5261 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5262 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5263 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5264 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5265 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5266 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5267 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5268 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5269 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5270 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5271 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5272 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5273 | {} |
| 5274 | }; |
| 5275 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5276 | static struct alc_config_preset alc260_presets[] = { |
| 5277 | [ALC260_BASIC] = { |
| 5278 | .mixers = { alc260_base_output_mixer, |
| 5279 | alc260_input_mixer, |
| 5280 | alc260_pc_beep_mixer, |
| 5281 | alc260_capture_mixer }, |
| 5282 | .init_verbs = { alc260_init_verbs }, |
| 5283 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5284 | .dac_nids = alc260_dac_nids, |
| 5285 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5286 | .adc_nids = alc260_adc_nids, |
| 5287 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5288 | .channel_mode = alc260_modes, |
| 5289 | .input_mux = &alc260_capture_source, |
| 5290 | }, |
| 5291 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5292 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5293 | alc260_input_mixer, |
| 5294 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5295 | .init_verbs = { alc260_init_verbs, |
| 5296 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5297 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5298 | .dac_nids = alc260_dac_nids, |
| 5299 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5300 | .adc_nids = alc260_hp_adc_nids, |
| 5301 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5302 | .channel_mode = alc260_modes, |
| 5303 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5304 | .unsol_event = alc260_hp_unsol_event, |
| 5305 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5306 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5307 | [ALC260_HP_DC7600] = { |
| 5308 | .mixers = { alc260_hp_dc7600_mixer, |
| 5309 | alc260_input_mixer, |
| 5310 | alc260_capture_alt_mixer }, |
| 5311 | .init_verbs = { alc260_init_verbs, |
| 5312 | alc260_hp_dc7600_verbs }, |
| 5313 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5314 | .dac_nids = alc260_dac_nids, |
| 5315 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5316 | .adc_nids = alc260_hp_adc_nids, |
| 5317 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5318 | .channel_mode = alc260_modes, |
| 5319 | .input_mux = &alc260_capture_source, |
| 5320 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5321 | .init_hook = alc260_hp_3012_automute, |
| 5322 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5323 | [ALC260_HP_3013] = { |
| 5324 | .mixers = { alc260_hp_3013_mixer, |
| 5325 | alc260_input_mixer, |
| 5326 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5327 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5328 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5329 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5330 | .dac_nids = alc260_dac_nids, |
| 5331 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5332 | .adc_nids = alc260_hp_adc_nids, |
| 5333 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5334 | .channel_mode = alc260_modes, |
| 5335 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5336 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5337 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5338 | }, |
| 5339 | [ALC260_FUJITSU_S702X] = { |
| 5340 | .mixers = { alc260_fujitsu_mixer, |
| 5341 | alc260_capture_mixer }, |
| 5342 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5343 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5344 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5345 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5346 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5347 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5348 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5349 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5350 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5351 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5352 | [ALC260_ACER] = { |
| 5353 | .mixers = { alc260_acer_mixer, |
| 5354 | alc260_capture_mixer }, |
| 5355 | .init_verbs = { alc260_acer_init_verbs }, |
| 5356 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5357 | .dac_nids = alc260_dac_nids, |
| 5358 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5359 | .adc_nids = alc260_dual_adc_nids, |
| 5360 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5361 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5362 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5363 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5364 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5365 | [ALC260_WILL] = { |
| 5366 | .mixers = { alc260_will_mixer, |
| 5367 | alc260_capture_mixer }, |
| 5368 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5369 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5370 | .dac_nids = alc260_dac_nids, |
| 5371 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5372 | .adc_nids = alc260_adc_nids, |
| 5373 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5374 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5375 | .channel_mode = alc260_modes, |
| 5376 | .input_mux = &alc260_capture_source, |
| 5377 | }, |
| 5378 | [ALC260_REPLACER_672V] = { |
| 5379 | .mixers = { alc260_replacer_672v_mixer, |
| 5380 | alc260_capture_mixer }, |
| 5381 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5382 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5383 | .dac_nids = alc260_dac_nids, |
| 5384 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5385 | .adc_nids = alc260_adc_nids, |
| 5386 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5387 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5388 | .channel_mode = alc260_modes, |
| 5389 | .input_mux = &alc260_capture_source, |
| 5390 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5391 | .init_hook = alc260_replacer_672v_automute, |
| 5392 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5393 | #ifdef CONFIG_SND_DEBUG |
| 5394 | [ALC260_TEST] = { |
| 5395 | .mixers = { alc260_test_mixer, |
| 5396 | alc260_capture_mixer }, |
| 5397 | .init_verbs = { alc260_test_init_verbs }, |
| 5398 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5399 | .dac_nids = alc260_test_dac_nids, |
| 5400 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5401 | .adc_nids = alc260_test_adc_nids, |
| 5402 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5403 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5404 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5405 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5406 | }, |
| 5407 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5408 | }; |
| 5409 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5410 | static int patch_alc260(struct hda_codec *codec) |
| 5411 | { |
| 5412 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5413 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5414 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5415 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5416 | if (spec == NULL) |
| 5417 | return -ENOMEM; |
| 5418 | |
| 5419 | codec->spec = spec; |
| 5420 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5421 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5422 | alc260_models, |
| 5423 | alc260_cfg_tbl); |
| 5424 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5425 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5426 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5427 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5428 | } |
| 5429 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5430 | if (board_config == ALC260_AUTO) { |
| 5431 | /* automatic parse from the BIOS config */ |
| 5432 | err = alc260_parse_auto_config(codec); |
| 5433 | if (err < 0) { |
| 5434 | alc_free(codec); |
| 5435 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5436 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5437 | printk(KERN_INFO |
| 5438 | "hda_codec: Cannot set up configuration " |
| 5439 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5440 | board_config = ALC260_BASIC; |
| 5441 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5442 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5443 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5444 | if (board_config != ALC260_AUTO) |
| 5445 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5446 | |
| 5447 | spec->stream_name_analog = "ALC260 Analog"; |
| 5448 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5449 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5450 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5451 | spec->stream_name_digital = "ALC260 Digital"; |
| 5452 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5453 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5454 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5455 | spec->vmaster_nid = 0x08; |
| 5456 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5457 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5458 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5459 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5460 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5461 | if (!spec->loopback.amplist) |
| 5462 | spec->loopback.amplist = alc260_loopbacks; |
| 5463 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5464 | |
| 5465 | return 0; |
| 5466 | } |
| 5467 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5468 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5469 | /* |
| 5470 | * ALC882 support |
| 5471 | * |
| 5472 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5473 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5474 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5475 | * 6-channel independent captures. |
| 5476 | * |
| 5477 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5478 | * driver yet). |
| 5479 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5480 | #define ALC882_DIGOUT_NID 0x06 |
| 5481 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5482 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5483 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5484 | { 8, NULL } |
| 5485 | }; |
| 5486 | |
| 5487 | static hda_nid_t alc882_dac_nids[4] = { |
| 5488 | /* front, rear, clfe, rear_surr */ |
| 5489 | 0x02, 0x03, 0x04, 0x05 |
| 5490 | }; |
| 5491 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5492 | /* identical with ALC880 */ |
| 5493 | #define alc882_adc_nids alc880_adc_nids |
| 5494 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5495 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5496 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5497 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5498 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5499 | /* input MUX */ |
| 5500 | /* FIXME: should be a matrix-type input source selection */ |
| 5501 | |
| 5502 | static struct hda_input_mux alc882_capture_source = { |
| 5503 | .num_items = 4, |
| 5504 | .items = { |
| 5505 | { "Mic", 0x0 }, |
| 5506 | { "Front Mic", 0x1 }, |
| 5507 | { "Line", 0x2 }, |
| 5508 | { "CD", 0x4 }, |
| 5509 | }, |
| 5510 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5511 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5512 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5513 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5514 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5515 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5516 | { |
| 5517 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5518 | struct alc_spec *spec = codec->spec; |
| 5519 | const struct hda_input_mux *imux = spec->input_mux; |
| 5520 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5521 | hda_nid_t nid = spec->capsrc_nids ? |
| 5522 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5523 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5524 | unsigned int i, idx; |
| 5525 | |
| 5526 | idx = ucontrol->value.enumerated.item[0]; |
| 5527 | if (idx >= imux->num_items) |
| 5528 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5529 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5530 | return 0; |
| 5531 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5532 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5533 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5534 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5535 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5536 | } |
| 5537 | *cur_val = idx; |
| 5538 | return 1; |
| 5539 | } |
| 5540 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5541 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5542 | * 2ch mode |
| 5543 | */ |
| 5544 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5545 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5546 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5547 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5548 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5549 | { } /* end */ |
| 5550 | }; |
| 5551 | |
| 5552 | /* |
| 5553 | * 6ch mode |
| 5554 | */ |
| 5555 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5556 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5557 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5558 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5559 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5560 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5561 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5562 | { } /* end */ |
| 5563 | }; |
| 5564 | |
| 5565 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5566 | { 2, alc882_3ST_ch2_init }, |
| 5567 | { 6, alc882_3ST_ch6_init }, |
| 5568 | }; |
| 5569 | |
| 5570 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5571 | * 6ch mode |
| 5572 | */ |
| 5573 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5574 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5575 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5576 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5577 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5578 | { } /* end */ |
| 5579 | }; |
| 5580 | |
| 5581 | /* |
| 5582 | * 8ch mode |
| 5583 | */ |
| 5584 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5585 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5586 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5587 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5588 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5589 | { } /* end */ |
| 5590 | }; |
| 5591 | |
| 5592 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5593 | { 6, alc882_sixstack_ch6_init }, |
| 5594 | { 8, alc882_sixstack_ch8_init }, |
| 5595 | }; |
| 5596 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5597 | /* |
| 5598 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5599 | */ |
| 5600 | |
| 5601 | /* |
| 5602 | * 2ch mode |
| 5603 | */ |
| 5604 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5605 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5606 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5607 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5608 | { } /* end */ |
| 5609 | }; |
| 5610 | |
| 5611 | /* |
| 5612 | * 6ch mode |
| 5613 | */ |
| 5614 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5615 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5616 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5617 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5618 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5619 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5620 | { } /* end */ |
| 5621 | }; |
| 5622 | |
| 5623 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5624 | { 2, alc885_mbp_ch2_init }, |
| 5625 | { 6, alc885_mbp_ch6_init }, |
| 5626 | }; |
| 5627 | |
| 5628 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5629 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5630 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5631 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5632 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5633 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5634 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5635 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5636 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5637 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5638 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5639 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5640 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5641 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5642 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5643 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5644 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5645 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5646 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5647 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5648 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5649 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5650 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5651 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5652 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5653 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5654 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5655 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5656 | { } /* end */ |
| 5657 | }; |
| 5658 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5659 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5660 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5661 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5662 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5663 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5664 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5665 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5666 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5667 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5668 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5669 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5670 | { } /* end */ |
| 5671 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5672 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5673 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5674 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5675 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5676 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5677 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5678 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5679 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5680 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5681 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5682 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5683 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5684 | { } /* end */ |
| 5685 | }; |
| 5686 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5687 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5688 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5689 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5690 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5691 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5692 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5693 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5694 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5695 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5696 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5697 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5698 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5699 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5700 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5701 | { } /* end */ |
| 5702 | }; |
| 5703 | |
| 5704 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5705 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5706 | */ |
| 5707 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5708 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5709 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5710 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5711 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5712 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5713 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5714 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5715 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5716 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5717 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5718 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5719 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5720 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5721 | { } /* end */ |
| 5722 | }; |
| 5723 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5724 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5725 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5726 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5727 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5728 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5729 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5730 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5731 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5732 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5733 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5734 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5735 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5736 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5737 | { } /* end */ |
| 5738 | }; |
| 5739 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5740 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5741 | { |
| 5742 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5743 | .name = "Channel Mode", |
| 5744 | .info = alc_ch_mode_info, |
| 5745 | .get = alc_ch_mode_get, |
| 5746 | .put = alc_ch_mode_put, |
| 5747 | }, |
| 5748 | { } /* end */ |
| 5749 | }; |
| 5750 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5751 | static struct hda_verb alc882_init_verbs[] = { |
| 5752 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5753 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5754 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5755 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5756 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5757 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5758 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5759 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5760 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5761 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5762 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5763 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5764 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5765 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5766 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5767 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5768 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5769 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5770 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5771 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5772 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5773 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5774 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5775 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5776 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5777 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5778 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5779 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5780 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5781 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5782 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5783 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5784 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5785 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5786 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5787 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5788 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5789 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5790 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5791 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5792 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5793 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5794 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5795 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5796 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5797 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5798 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5799 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5800 | |
| 5801 | /* FIXME: use matrix-type input source selection */ |
| 5802 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5803 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5804 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5805 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5806 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5807 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5808 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5809 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5810 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5811 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5812 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5813 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5814 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5815 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5816 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5817 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5818 | /* ADC1: mute amp left and right */ |
| 5819 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5820 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5821 | /* ADC2: mute amp left and right */ |
| 5822 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5823 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5824 | /* ADC3: mute amp left and right */ |
| 5825 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5826 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5827 | |
| 5828 | { } |
| 5829 | }; |
| 5830 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5831 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5832 | /* change to EAPD mode */ |
| 5833 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5834 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5835 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5836 | }; |
| 5837 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5838 | /* Mac Pro test */ |
| 5839 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5840 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5841 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5842 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5843 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5844 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5845 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5846 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5847 | { } /* end */ |
| 5848 | }; |
| 5849 | |
| 5850 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5851 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5852 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5853 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5854 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5855 | /* Front Pin: output 0 (0x0c) */ |
| 5856 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5857 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5858 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5859 | /* Front Mic pin: input vref at 80% */ |
| 5860 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5861 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5862 | /* Speaker: output */ |
| 5863 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5864 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5865 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5866 | /* Headphone output (output 0 - 0x0c) */ |
| 5867 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5868 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5869 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5870 | |
| 5871 | /* FIXME: use matrix-type input source selection */ |
| 5872 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5873 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5874 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5875 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5876 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5877 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5878 | /* Input mixer2 */ |
| 5879 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5880 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5881 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5882 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5883 | /* Input mixer3 */ |
| 5884 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5885 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5886 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5887 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5888 | /* ADC1: mute amp left and right */ |
| 5889 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5890 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5891 | /* ADC2: mute amp left and right */ |
| 5892 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5893 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5894 | /* ADC3: mute amp left and right */ |
| 5895 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5896 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5897 | |
| 5898 | { } |
| 5899 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5900 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5901 | /* Macbook Pro rev3 */ |
| 5902 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5903 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5904 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5905 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5906 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5907 | /* Rear mixer */ |
| 5908 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5909 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5910 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5911 | /* Front Pin: output 0 (0x0c) */ |
| 5912 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5913 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5914 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5915 | /* HP Pin: output 0 (0x0d) */ |
| 5916 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5917 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5918 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5919 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5920 | /* Mic (rear) pin: input vref at 80% */ |
| 5921 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5922 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5923 | /* Front Mic pin: input vref at 80% */ |
| 5924 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5925 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5926 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5927 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5928 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5929 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5930 | |
| 5931 | /* FIXME: use matrix-type input source selection */ |
| 5932 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5933 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5934 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5935 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5936 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5937 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5938 | /* Input mixer2 */ |
| 5939 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5940 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5941 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5942 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5943 | /* Input mixer3 */ |
| 5944 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5945 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5946 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5947 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5948 | /* ADC1: mute amp left and right */ |
| 5949 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5950 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5951 | /* ADC2: mute amp left and right */ |
| 5952 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5953 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5954 | /* ADC3: mute amp left and right */ |
| 5955 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5956 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5957 | |
| 5958 | { } |
| 5959 | }; |
| 5960 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5961 | /* iMac 24 mixer. */ |
| 5962 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5963 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5964 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5965 | { } /* end */ |
| 5966 | }; |
| 5967 | |
| 5968 | /* iMac 24 init verbs. */ |
| 5969 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5970 | /* Internal speakers: output 0 (0x0c) */ |
| 5971 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5972 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5973 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5974 | /* Internal speakers: output 0 (0x0c) */ |
| 5975 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5976 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5977 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5978 | /* Headphone: output 0 (0x0c) */ |
| 5979 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5980 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5981 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5982 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5983 | /* Front Mic: input vref at 80% */ |
| 5984 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5985 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5986 | { } |
| 5987 | }; |
| 5988 | |
| 5989 | /* Toggle speaker-output according to the hp-jack state */ |
| 5990 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5991 | { |
| 5992 | unsigned int present; |
| 5993 | |
| 5994 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5995 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5996 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5997 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5998 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5999 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6000 | } |
| 6001 | |
| 6002 | /* Processes unsolicited events. */ |
| 6003 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6004 | unsigned int res) |
| 6005 | { |
| 6006 | /* Headphone insertion or removal. */ |
| 6007 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6008 | alc885_imac24_automute(codec); |
| 6009 | } |
| 6010 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6011 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6012 | { |
| 6013 | unsigned int present; |
| 6014 | |
| 6015 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6016 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6017 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6018 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6019 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6020 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6021 | |
| 6022 | } |
| 6023 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6024 | unsigned int res) |
| 6025 | { |
| 6026 | /* Headphone insertion or removal. */ |
| 6027 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6028 | alc885_mbp3_automute(codec); |
| 6029 | } |
| 6030 | |
| 6031 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6032 | static struct hda_verb alc882_targa_verbs[] = { |
| 6033 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6034 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6035 | |
| 6036 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6037 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6038 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6039 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6040 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6041 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6042 | |
| 6043 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6044 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6045 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6046 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6047 | { } /* end */ |
| 6048 | }; |
| 6049 | |
| 6050 | /* toggle speaker-output according to the hp-jack state */ |
| 6051 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6052 | { |
| 6053 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6054 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6055 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6056 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6057 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6058 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6059 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6060 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6061 | } |
| 6062 | |
| 6063 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6064 | { |
| 6065 | /* Looks like the unsol event is incompatible with the standard |
| 6066 | * definition. 4bit tag is placed at 26 bit! |
| 6067 | */ |
| 6068 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6069 | alc882_targa_automute(codec); |
| 6070 | } |
| 6071 | } |
| 6072 | |
| 6073 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6074 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6075 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6076 | |
| 6077 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6078 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6079 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6080 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6081 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6082 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6083 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6084 | |
| 6085 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6086 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6087 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6088 | { } /* end */ |
| 6089 | }; |
| 6090 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6091 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6092 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6093 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6094 | |
| 6095 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6096 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6097 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6098 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6099 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6100 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6101 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6102 | |
| 6103 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6104 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6105 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6106 | { } /* end */ |
| 6107 | }; |
| 6108 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6109 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6110 | { |
| 6111 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6112 | |
| 6113 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6114 | AC_VERB_GET_GPIO_DATA, 0); |
| 6115 | |
| 6116 | if (!muted) |
| 6117 | gpiostate |= (1 << pin); |
| 6118 | else |
| 6119 | gpiostate &= ~(1 << pin); |
| 6120 | |
| 6121 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6122 | AC_VERB_GET_GPIO_MASK, 0); |
| 6123 | gpiomask |= (1 << pin); |
| 6124 | |
| 6125 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6126 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6127 | gpiodir |= (1 << pin); |
| 6128 | |
| 6129 | |
| 6130 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6131 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6132 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6133 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6134 | |
| 6135 | msleep(1); |
| 6136 | |
| 6137 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6138 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6139 | } |
| 6140 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6141 | /* set up GPIO at initialization */ |
| 6142 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6143 | { |
| 6144 | alc882_gpio_mute(codec, 0, 0); |
| 6145 | alc882_gpio_mute(codec, 1, 0); |
| 6146 | } |
| 6147 | |
| 6148 | /* set up GPIO and update auto-muting at initialization */ |
| 6149 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6150 | { |
| 6151 | alc885_macpro_init_hook(codec); |
| 6152 | alc885_imac24_automute(codec); |
| 6153 | } |
| 6154 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6155 | /* |
| 6156 | * generic initialization of ADC, input mixers and output mixers |
| 6157 | */ |
| 6158 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6159 | /* |
| 6160 | * Unmute ADC0-2 and set the default input to mic-in |
| 6161 | */ |
| 6162 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6163 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6164 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6165 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6166 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6167 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6168 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6169 | /* 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] | 6170 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6171 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6172 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6173 | */ |
| 6174 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6175 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6176 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6177 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6178 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6179 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6180 | |
| 6181 | /* |
| 6182 | * Set up output mixers (0x0c - 0x0f) |
| 6183 | */ |
| 6184 | /* set vol=0 to output mixers */ |
| 6185 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6186 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6187 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6188 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6189 | /* set up input amps for analog loopback */ |
| 6190 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6191 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6192 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6193 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6194 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6195 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6196 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6197 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6198 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6199 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6200 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6201 | |
| 6202 | /* FIXME: use matrix-type input source selection */ |
| 6203 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6204 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6205 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6206 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6207 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6208 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6209 | /* Input mixer2 */ |
| 6210 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6211 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6212 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6213 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6214 | /* Input mixer3 */ |
| 6215 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6216 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6217 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6218 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6219 | |
| 6220 | { } |
| 6221 | }; |
| 6222 | |
| 6223 | /* capture mixer elements */ |
| 6224 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 6225 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6226 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6227 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6228 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6229 | { |
| 6230 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6231 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6232 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6233 | */ |
| 6234 | /* .name = "Capture Source", */ |
| 6235 | .name = "Input Source", |
| 6236 | .count = 2, |
| 6237 | .info = alc882_mux_enum_info, |
| 6238 | .get = alc882_mux_enum_get, |
| 6239 | .put = alc882_mux_enum_put, |
| 6240 | }, |
| 6241 | { } /* end */ |
| 6242 | }; |
| 6243 | |
| 6244 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 6245 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 6246 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 6247 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 6248 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 6249 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 6250 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 6251 | { |
| 6252 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6253 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6254 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6255 | */ |
| 6256 | /* .name = "Capture Source", */ |
| 6257 | .name = "Input Source", |
| 6258 | .count = 3, |
| 6259 | .info = alc882_mux_enum_info, |
| 6260 | .get = alc882_mux_enum_get, |
| 6261 | .put = alc882_mux_enum_put, |
| 6262 | }, |
| 6263 | { } /* end */ |
| 6264 | }; |
| 6265 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6266 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6267 | #define alc882_loopbacks alc880_loopbacks |
| 6268 | #endif |
| 6269 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6270 | /* pcm configuration: identiacal with ALC880 */ |
| 6271 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6272 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6273 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6274 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6275 | |
| 6276 | /* |
| 6277 | * configuration and preset |
| 6278 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6279 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6280 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6281 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6282 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6283 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6284 | [ALC882_TARGA] = "targa", |
| 6285 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6286 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6287 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6288 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6289 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6290 | [ALC882_AUTO] = "auto", |
| 6291 | }; |
| 6292 | |
| 6293 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6294 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6295 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6296 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6297 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6298 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6299 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6300 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6301 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6302 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6303 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6304 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6305 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6306 | {} |
| 6307 | }; |
| 6308 | |
| 6309 | static struct alc_config_preset alc882_presets[] = { |
| 6310 | [ALC882_3ST_DIG] = { |
| 6311 | .mixers = { alc882_base_mixer }, |
| 6312 | .init_verbs = { alc882_init_verbs }, |
| 6313 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6314 | .dac_nids = alc882_dac_nids, |
| 6315 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6316 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6317 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6318 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6319 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6320 | .input_mux = &alc882_capture_source, |
| 6321 | }, |
| 6322 | [ALC882_6ST_DIG] = { |
| 6323 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6324 | .init_verbs = { alc882_init_verbs }, |
| 6325 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6326 | .dac_nids = alc882_dac_nids, |
| 6327 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6328 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6329 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6330 | .channel_mode = alc882_sixstack_modes, |
| 6331 | .input_mux = &alc882_capture_source, |
| 6332 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6333 | [ALC882_ARIMA] = { |
| 6334 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6335 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6336 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6337 | .dac_nids = alc882_dac_nids, |
| 6338 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6339 | .channel_mode = alc882_sixstack_modes, |
| 6340 | .input_mux = &alc882_capture_source, |
| 6341 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6342 | [ALC882_W2JC] = { |
| 6343 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6344 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6345 | alc880_gpio1_init_verbs }, |
| 6346 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6347 | .dac_nids = alc882_dac_nids, |
| 6348 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6349 | .channel_mode = alc880_threestack_modes, |
| 6350 | .need_dac_fix = 1, |
| 6351 | .input_mux = &alc882_capture_source, |
| 6352 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6353 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6354 | [ALC885_MBP3] = { |
| 6355 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6356 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6357 | alc880_gpio1_init_verbs }, |
| 6358 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6359 | .dac_nids = alc882_dac_nids, |
| 6360 | .channel_mode = alc885_mbp_6ch_modes, |
| 6361 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6362 | .input_mux = &alc882_capture_source, |
| 6363 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6364 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6365 | .unsol_event = alc885_mbp3_unsol_event, |
| 6366 | .init_hook = alc885_mbp3_automute, |
| 6367 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6368 | [ALC885_MACPRO] = { |
| 6369 | .mixers = { alc882_macpro_mixer }, |
| 6370 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6371 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6372 | .dac_nids = alc882_dac_nids, |
| 6373 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6374 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6375 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6376 | .channel_mode = alc882_ch_modes, |
| 6377 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6378 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6379 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6380 | [ALC885_IMAC24] = { |
| 6381 | .mixers = { alc885_imac24_mixer }, |
| 6382 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6383 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6384 | .dac_nids = alc882_dac_nids, |
| 6385 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6386 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6387 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6388 | .channel_mode = alc882_ch_modes, |
| 6389 | .input_mux = &alc882_capture_source, |
| 6390 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6391 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6392 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6393 | [ALC882_TARGA] = { |
| 6394 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6395 | alc882_capture_mixer }, |
| 6396 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6397 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6398 | .dac_nids = alc882_dac_nids, |
| 6399 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6400 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6401 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6402 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6403 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6404 | .channel_mode = alc882_3ST_6ch_modes, |
| 6405 | .need_dac_fix = 1, |
| 6406 | .input_mux = &alc882_capture_source, |
| 6407 | .unsol_event = alc882_targa_unsol_event, |
| 6408 | .init_hook = alc882_targa_automute, |
| 6409 | }, |
| 6410 | [ALC882_ASUS_A7J] = { |
| 6411 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6412 | alc882_capture_mixer }, |
| 6413 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6414 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6415 | .dac_nids = alc882_dac_nids, |
| 6416 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6417 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6418 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6419 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6420 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6421 | .channel_mode = alc882_3ST_6ch_modes, |
| 6422 | .need_dac_fix = 1, |
| 6423 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6424 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6425 | [ALC882_ASUS_A7M] = { |
| 6426 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6427 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6428 | alc880_gpio1_init_verbs, |
| 6429 | alc882_asus_a7m_verbs }, |
| 6430 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6431 | .dac_nids = alc882_dac_nids, |
| 6432 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6433 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6434 | .channel_mode = alc880_threestack_modes, |
| 6435 | .need_dac_fix = 1, |
| 6436 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6437 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6438 | }; |
| 6439 | |
| 6440 | |
| 6441 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6442 | * Pin config fixes |
| 6443 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6444 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6445 | PINFIX_ABIT_AW9D_MAX |
| 6446 | }; |
| 6447 | |
| 6448 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6449 | { 0x15, 0x01080104 }, /* side */ |
| 6450 | { 0x16, 0x01011012 }, /* rear */ |
| 6451 | { 0x17, 0x01016011 }, /* clfe */ |
| 6452 | { } |
| 6453 | }; |
| 6454 | |
| 6455 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6456 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6457 | }; |
| 6458 | |
| 6459 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6460 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6461 | {} |
| 6462 | }; |
| 6463 | |
| 6464 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6465 | * BIOS auto configuration |
| 6466 | */ |
| 6467 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6468 | hda_nid_t nid, int pin_type, |
| 6469 | int dac_idx) |
| 6470 | { |
| 6471 | /* set as output */ |
| 6472 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6473 | int idx; |
| 6474 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6475 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6476 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6477 | idx = 4; |
| 6478 | else |
| 6479 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6480 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6481 | |
| 6482 | } |
| 6483 | |
| 6484 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6485 | { |
| 6486 | struct alc_spec *spec = codec->spec; |
| 6487 | int i; |
| 6488 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6489 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6490 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6491 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6492 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6493 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6494 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6495 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6496 | } |
| 6497 | } |
| 6498 | |
| 6499 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6500 | { |
| 6501 | struct alc_spec *spec = codec->spec; |
| 6502 | hda_nid_t pin; |
| 6503 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6504 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6505 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6506 | /* use dac 0 */ |
| 6507 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6508 | pin = spec->autocfg.speaker_pins[0]; |
| 6509 | if (pin) |
| 6510 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6511 | } |
| 6512 | |
| 6513 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6514 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6515 | |
| 6516 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6517 | { |
| 6518 | struct alc_spec *spec = codec->spec; |
| 6519 | int i; |
| 6520 | |
| 6521 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6522 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6523 | unsigned int vref; |
| 6524 | if (!nid) |
| 6525 | continue; |
| 6526 | vref = PIN_IN; |
| 6527 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6528 | unsigned int pincap; |
| 6529 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6530 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6531 | AC_PINCAP_VREF_80) |
| 6532 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6533 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6534 | snd_hda_codec_write(codec, nid, 0, |
| 6535 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6536 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6537 | snd_hda_codec_write(codec, nid, 0, |
| 6538 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6539 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6540 | } |
| 6541 | } |
| 6542 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6543 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 6544 | { |
| 6545 | struct alc_spec *spec = codec->spec; |
| 6546 | const struct hda_input_mux *imux = spec->input_mux; |
| 6547 | int c; |
| 6548 | |
| 6549 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 6550 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 6551 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 6552 | int conns, mute, idx, item; |
| 6553 | |
| 6554 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 6555 | ARRAY_SIZE(conn_list)); |
| 6556 | if (conns < 0) |
| 6557 | continue; |
| 6558 | for (idx = 0; idx < conns; idx++) { |
| 6559 | /* if the current connection is the selected one, |
| 6560 | * unmute it as default - otherwise mute it |
| 6561 | */ |
| 6562 | mute = AMP_IN_MUTE(idx); |
| 6563 | for (item = 0; item < imux->num_items; item++) { |
| 6564 | if (imux->items[item].index == idx) { |
| 6565 | if (spec->cur_mux[c] == item) |
| 6566 | mute = AMP_IN_UNMUTE(idx); |
| 6567 | break; |
| 6568 | } |
| 6569 | } |
| 6570 | snd_hda_codec_write(codec, nid, 0, |
| 6571 | AC_VERB_SET_AMP_GAIN_MUTE, mute); |
| 6572 | } |
| 6573 | } |
| 6574 | } |
| 6575 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6576 | /* add mic boosts if needed */ |
| 6577 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6578 | { |
| 6579 | struct alc_spec *spec = codec->spec; |
| 6580 | int err; |
| 6581 | hda_nid_t nid; |
| 6582 | |
| 6583 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6584 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6585 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6586 | "Mic Boost", |
| 6587 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6588 | if (err < 0) |
| 6589 | return err; |
| 6590 | } |
| 6591 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6592 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6593 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6594 | "Front Mic Boost", |
| 6595 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6596 | if (err < 0) |
| 6597 | return err; |
| 6598 | } |
| 6599 | return 0; |
| 6600 | } |
| 6601 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6602 | /* almost identical with ALC880 parser... */ |
| 6603 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6604 | { |
| 6605 | struct alc_spec *spec = codec->spec; |
| 6606 | int err = alc880_parse_auto_config(codec); |
| 6607 | |
| 6608 | if (err < 0) |
| 6609 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6610 | else if (!err) |
| 6611 | return 0; /* no config found */ |
| 6612 | |
| 6613 | err = alc_auto_add_mic_boost(codec); |
| 6614 | if (err < 0) |
| 6615 | return err; |
| 6616 | |
| 6617 | /* hack - override the init verbs */ |
| 6618 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6619 | |
| 6620 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6621 | } |
| 6622 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6623 | /* additional initialization for auto-configuration model */ |
| 6624 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6625 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6626 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6627 | alc882_auto_init_multi_out(codec); |
| 6628 | alc882_auto_init_hp_out(codec); |
| 6629 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6630 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6631 | if (spec->unsol_event) |
| 6632 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6633 | } |
| 6634 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6635 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6636 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6637 | static int patch_alc882(struct hda_codec *codec) |
| 6638 | { |
| 6639 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6640 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6641 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6642 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6643 | if (spec == NULL) |
| 6644 | return -ENOMEM; |
| 6645 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6646 | codec->spec = spec; |
| 6647 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6648 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6649 | alc882_models, |
| 6650 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6651 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6652 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6653 | /* Pick up systems that don't supply PCI SSID */ |
| 6654 | switch (codec->subsystem_id) { |
| 6655 | case 0x106b0c00: /* Mac Pro */ |
| 6656 | board_config = ALC885_MACPRO; |
| 6657 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6658 | case 0x106b1000: /* iMac 24 */ |
| 6659 | board_config = ALC885_IMAC24; |
| 6660 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6661 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame^] | 6662 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6663 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6664 | case 0x106b3600: /* Macbook 3.1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6665 | board_config = ALC885_MBP3; |
| 6666 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6667 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6668 | /* ALC889A is handled better as ALC888-compatible */ |
| 6669 | if (codec->revision_id == 0x100103) { |
| 6670 | alc_free(codec); |
| 6671 | return patch_alc883(codec); |
| 6672 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6673 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6674 | "trying auto-probe from BIOS...\n"); |
| 6675 | board_config = ALC882_AUTO; |
| 6676 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6677 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6678 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6679 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6680 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6681 | if (board_config == ALC882_AUTO) { |
| 6682 | /* automatic parse from the BIOS config */ |
| 6683 | err = alc882_parse_auto_config(codec); |
| 6684 | if (err < 0) { |
| 6685 | alc_free(codec); |
| 6686 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6687 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6688 | printk(KERN_INFO |
| 6689 | "hda_codec: Cannot set up configuration " |
| 6690 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6691 | board_config = ALC882_3ST_DIG; |
| 6692 | } |
| 6693 | } |
| 6694 | |
| 6695 | if (board_config != ALC882_AUTO) |
| 6696 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6697 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 6698 | if (codec->vendor_id == 0x10ec0885) { |
| 6699 | spec->stream_name_analog = "ALC885 Analog"; |
| 6700 | spec->stream_name_digital = "ALC885 Digital"; |
| 6701 | } else { |
| 6702 | spec->stream_name_analog = "ALC882 Analog"; |
| 6703 | spec->stream_name_digital = "ALC882 Digital"; |
| 6704 | } |
| 6705 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6706 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6707 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6708 | /* FIXME: setup DAC5 */ |
| 6709 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6710 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6711 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6712 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6713 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6714 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6715 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6716 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6717 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6718 | /* get type */ |
| 6719 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6720 | if (wcap != AC_WID_AUD_IN) { |
| 6721 | spec->adc_nids = alc882_adc_nids_alt; |
| 6722 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6723 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6724 | spec->mixers[spec->num_mixers] = |
| 6725 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6726 | spec->num_mixers++; |
| 6727 | } else { |
| 6728 | spec->adc_nids = alc882_adc_nids; |
| 6729 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6730 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6731 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6732 | spec->num_mixers++; |
| 6733 | } |
| 6734 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6735 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6736 | spec->vmaster_nid = 0x0c; |
| 6737 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6738 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6739 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6740 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6741 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6742 | if (!spec->loopback.amplist) |
| 6743 | spec->loopback.amplist = alc882_loopbacks; |
| 6744 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6745 | |
| 6746 | return 0; |
| 6747 | } |
| 6748 | |
| 6749 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6750 | * ALC883 support |
| 6751 | * |
| 6752 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6753 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6754 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6755 | * 6-channel independent captures. |
| 6756 | * |
| 6757 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6758 | * driver yet). |
| 6759 | */ |
| 6760 | #define ALC883_DIGOUT_NID 0x06 |
| 6761 | #define ALC883_DIGIN_NID 0x0a |
| 6762 | |
| 6763 | static hda_nid_t alc883_dac_nids[4] = { |
| 6764 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6765 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6766 | }; |
| 6767 | |
| 6768 | static hda_nid_t alc883_adc_nids[2] = { |
| 6769 | /* ADC1-2 */ |
| 6770 | 0x08, 0x09, |
| 6771 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6772 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6773 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6774 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6775 | /* input MUX */ |
| 6776 | /* FIXME: should be a matrix-type input source selection */ |
| 6777 | |
| 6778 | static struct hda_input_mux alc883_capture_source = { |
| 6779 | .num_items = 4, |
| 6780 | .items = { |
| 6781 | { "Mic", 0x0 }, |
| 6782 | { "Front Mic", 0x1 }, |
| 6783 | { "Line", 0x2 }, |
| 6784 | { "CD", 0x4 }, |
| 6785 | }, |
| 6786 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6787 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6788 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6789 | .num_items = 4, |
| 6790 | .items = { |
| 6791 | { "Mic", 0x1 }, |
| 6792 | { "Front Mic", 0x0 }, |
| 6793 | { "Line", 0x2 }, |
| 6794 | { "CD", 0x4 }, |
| 6795 | }, |
| 6796 | }; |
| 6797 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6798 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6799 | .num_items = 2, |
| 6800 | .items = { |
| 6801 | { "Mic", 0x1 }, |
| 6802 | { "Line", 0x2 }, |
| 6803 | }, |
| 6804 | }; |
| 6805 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6806 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6807 | .num_items = 4, |
| 6808 | .items = { |
| 6809 | { "Mic", 0x0 }, |
| 6810 | { "iMic", 0x1 }, |
| 6811 | { "Line", 0x2 }, |
| 6812 | { "CD", 0x4 }, |
| 6813 | }, |
| 6814 | }; |
| 6815 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6816 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6817 | .num_items = 2, |
| 6818 | .items = { |
| 6819 | { "Mic", 0x0 }, |
| 6820 | { "Int Mic", 0x1 }, |
| 6821 | }, |
| 6822 | }; |
| 6823 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 6824 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6825 | .num_items = 3, |
| 6826 | .items = { |
| 6827 | { "Mic", 0x0 }, |
| 6828 | { "Front Mic", 0x1 }, |
| 6829 | { "Line", 0x4 }, |
| 6830 | }, |
| 6831 | }; |
| 6832 | |
| 6833 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6834 | .num_items = 2, |
| 6835 | .items = { |
| 6836 | { "Mic", 0x0 }, |
| 6837 | { "Line", 0x2 }, |
| 6838 | }, |
| 6839 | }; |
| 6840 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6841 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6842 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6843 | /* ALC883 has the ALC882-type input selection */ |
| 6844 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6845 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6846 | /* |
| 6847 | * 2ch mode |
| 6848 | */ |
| 6849 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6850 | { 2, NULL } |
| 6851 | }; |
| 6852 | |
| 6853 | /* |
| 6854 | * 2ch mode |
| 6855 | */ |
| 6856 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6857 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6858 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6859 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6860 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6861 | { } /* end */ |
| 6862 | }; |
| 6863 | |
| 6864 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6865 | * 4ch mode |
| 6866 | */ |
| 6867 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6868 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6869 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6870 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6871 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6872 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6873 | { } /* end */ |
| 6874 | }; |
| 6875 | |
| 6876 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6877 | * 6ch mode |
| 6878 | */ |
| 6879 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6880 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6881 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6882 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6883 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6884 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6885 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6886 | { } /* end */ |
| 6887 | }; |
| 6888 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6889 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6890 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6891 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6892 | { 6, alc883_3ST_ch6_init }, |
| 6893 | }; |
| 6894 | |
| 6895 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6896 | * 2ch mode |
| 6897 | */ |
| 6898 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6899 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6900 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6901 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6902 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6903 | { } /* end */ |
| 6904 | }; |
| 6905 | |
| 6906 | /* |
| 6907 | * 4ch mode |
| 6908 | */ |
| 6909 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6910 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6911 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6912 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6913 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6914 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6915 | { } /* end */ |
| 6916 | }; |
| 6917 | |
| 6918 | /* |
| 6919 | * 6ch mode |
| 6920 | */ |
| 6921 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6922 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6923 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6924 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6925 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6926 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6927 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6928 | { } /* end */ |
| 6929 | }; |
| 6930 | |
| 6931 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6932 | { 2, alc883_3ST_ch2_intel_init }, |
| 6933 | { 4, alc883_3ST_ch4_intel_init }, |
| 6934 | { 6, alc883_3ST_ch6_intel_init }, |
| 6935 | }; |
| 6936 | |
| 6937 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6938 | * 6ch mode |
| 6939 | */ |
| 6940 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6941 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6942 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6943 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6944 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6945 | { } /* end */ |
| 6946 | }; |
| 6947 | |
| 6948 | /* |
| 6949 | * 8ch mode |
| 6950 | */ |
| 6951 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6952 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6953 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6954 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6955 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6956 | { } /* end */ |
| 6957 | }; |
| 6958 | |
| 6959 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6960 | { 6, alc883_sixstack_ch6_init }, |
| 6961 | { 8, alc883_sixstack_ch8_init }, |
| 6962 | }; |
| 6963 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6964 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6965 | /* eanable EAPD on medion laptop */ |
| 6966 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6967 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6968 | { } |
| 6969 | }; |
| 6970 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6971 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6972 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6973 | */ |
| 6974 | |
| 6975 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6976 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6977 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6978 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6979 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6980 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6981 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6982 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6983 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6984 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6985 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6986 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6987 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6988 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6989 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6990 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6991 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6992 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6993 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6994 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6995 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6996 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6997 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6998 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6999 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7000 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7001 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7002 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7003 | { |
| 7004 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7005 | /* .name = "Capture Source", */ |
| 7006 | .name = "Input Source", |
| 7007 | .count = 2, |
| 7008 | .info = alc883_mux_enum_info, |
| 7009 | .get = alc883_mux_enum_get, |
| 7010 | .put = alc883_mux_enum_put, |
| 7011 | }, |
| 7012 | { } /* end */ |
| 7013 | }; |
| 7014 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7015 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7016 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7017 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7018 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7019 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7020 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7021 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7022 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7023 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7024 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7025 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7026 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7027 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7028 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7029 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7030 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7031 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7032 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7033 | { |
| 7034 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7035 | /* .name = "Capture Source", */ |
| 7036 | .name = "Input Source", |
| 7037 | .count = 2, |
| 7038 | .info = alc883_mux_enum_info, |
| 7039 | .get = alc883_mux_enum_get, |
| 7040 | .put = alc883_mux_enum_put, |
| 7041 | }, |
| 7042 | { } /* end */ |
| 7043 | }; |
| 7044 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7045 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7046 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7047 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7048 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7049 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7050 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7051 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7052 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7053 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7054 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7055 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7056 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7057 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7058 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7059 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7060 | { |
| 7061 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7062 | /* .name = "Capture Source", */ |
| 7063 | .name = "Input Source", |
| 7064 | .count = 2, |
| 7065 | .info = alc883_mux_enum_info, |
| 7066 | .get = alc883_mux_enum_get, |
| 7067 | .put = alc883_mux_enum_put, |
| 7068 | }, |
| 7069 | { } /* end */ |
| 7070 | }; |
| 7071 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7072 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7073 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7074 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7075 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7076 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7077 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7078 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7079 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7080 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7081 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7082 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, 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 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7099 | static struct snd_kcontrol_new alc883_3ST_2ch_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_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7103 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7104 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7105 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7106 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7107 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7108 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7109 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7110 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7111 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7112 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7113 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7114 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7115 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7116 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7117 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7118 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7119 | { |
| 7120 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7121 | /* .name = "Capture Source", */ |
| 7122 | .name = "Input Source", |
| 7123 | .count = 2, |
| 7124 | .info = alc883_mux_enum_info, |
| 7125 | .get = alc883_mux_enum_get, |
| 7126 | .put = alc883_mux_enum_put, |
| 7127 | }, |
| 7128 | { } /* end */ |
| 7129 | }; |
| 7130 | |
| 7131 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7132 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7133 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7134 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7135 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7136 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7137 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7138 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7139 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7140 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7141 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7142 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7143 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7144 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7145 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7146 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7147 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7148 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7149 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7150 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7151 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7152 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7153 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7154 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7155 | { |
| 7156 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7157 | /* .name = "Capture Source", */ |
| 7158 | .name = "Input Source", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7159 | .count = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7160 | .info = alc883_mux_enum_info, |
| 7161 | .get = alc883_mux_enum_get, |
| 7162 | .put = alc883_mux_enum_put, |
| 7163 | }, |
| 7164 | { } /* end */ |
| 7165 | }; |
| 7166 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7167 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7168 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7169 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7170 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7171 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7172 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7173 | HDA_OUTPUT), |
| 7174 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7175 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7176 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7177 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7178 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7179 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7180 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7181 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7182 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7183 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7184 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7185 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7186 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7187 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7188 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7189 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7190 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7191 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7192 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7193 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7194 | { |
| 7195 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7196 | /* .name = "Capture Source", */ |
| 7197 | .name = "Input Source", |
| 7198 | .count = 2, |
| 7199 | .info = alc883_mux_enum_info, |
| 7200 | .get = alc883_mux_enum_get, |
| 7201 | .put = alc883_mux_enum_put, |
| 7202 | }, |
| 7203 | { } /* end */ |
| 7204 | }; |
| 7205 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7206 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7207 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7208 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7209 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7210 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7211 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7212 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7213 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7214 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7215 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7216 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7217 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7218 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7219 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7220 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7221 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7223 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7224 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7225 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7226 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7227 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7228 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7229 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7230 | |
| 7231 | { |
| 7232 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7233 | /* .name = "Capture Source", */ |
| 7234 | .name = "Input Source", |
| 7235 | .count = 1, |
| 7236 | .info = alc883_mux_enum_info, |
| 7237 | .get = alc883_mux_enum_get, |
| 7238 | .put = alc883_mux_enum_put, |
| 7239 | }, |
| 7240 | { } /* end */ |
| 7241 | }; |
| 7242 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7243 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7244 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7245 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7246 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7247 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7248 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7249 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7250 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7251 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7252 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7253 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7254 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7255 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7256 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7257 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7258 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7259 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7260 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7261 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7262 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7263 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7264 | { |
| 7265 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7266 | /* .name = "Capture Source", */ |
| 7267 | .name = "Input Source", |
| 7268 | .count = 2, |
| 7269 | .info = alc883_mux_enum_info, |
| 7270 | .get = alc883_mux_enum_get, |
| 7271 | .put = alc883_mux_enum_put, |
| 7272 | }, |
| 7273 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7274 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7275 | |
| 7276 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7277 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7278 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7279 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7280 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7281 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7282 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7283 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7284 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7285 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7286 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7287 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7288 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7289 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7290 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7291 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7292 | { |
| 7293 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7294 | /* .name = "Capture Source", */ |
| 7295 | .name = "Input Source", |
| 7296 | .count = 2, |
| 7297 | .info = alc883_mux_enum_info, |
| 7298 | .get = alc883_mux_enum_get, |
| 7299 | .put = alc883_mux_enum_put, |
| 7300 | }, |
| 7301 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7302 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7303 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7304 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7305 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7306 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7307 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7308 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7309 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7310 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7311 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7312 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7313 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7314 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7315 | { |
| 7316 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7317 | /* .name = "Capture Source", */ |
| 7318 | .name = "Input Source", |
| 7319 | .count = 1, |
| 7320 | .info = alc883_mux_enum_info, |
| 7321 | .get = alc883_mux_enum_get, |
| 7322 | .put = alc883_mux_enum_put, |
| 7323 | }, |
| 7324 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7325 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7326 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7327 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7328 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7329 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7330 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7331 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7332 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7333 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7334 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7335 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7336 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7337 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7338 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7339 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7340 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7341 | { |
| 7342 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7343 | /* .name = "Capture Source", */ |
| 7344 | .name = "Input Source", |
| 7345 | .count = 2, |
| 7346 | .info = alc883_mux_enum_info, |
| 7347 | .get = alc883_mux_enum_get, |
| 7348 | .put = alc883_mux_enum_put, |
| 7349 | }, |
| 7350 | { } /* end */ |
| 7351 | }; |
| 7352 | |
| 7353 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7354 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7355 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7356 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7357 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7358 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7359 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7360 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7361 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7362 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7363 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7364 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7365 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7366 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7367 | { |
| 7368 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7369 | /* .name = "Capture Source", */ |
| 7370 | .name = "Input Source", |
| 7371 | .count = 2, |
| 7372 | .info = alc883_mux_enum_info, |
| 7373 | .get = alc883_mux_enum_get, |
| 7374 | .put = alc883_mux_enum_put, |
| 7375 | }, |
| 7376 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7377 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7378 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7379 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7380 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7381 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7382 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7383 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7384 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7385 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7386 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7387 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7388 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7389 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7390 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7391 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7392 | { |
| 7393 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7394 | /* .name = "Capture Source", */ |
| 7395 | .name = "Input Source", |
| 7396 | .count = 2, |
| 7397 | .info = alc883_mux_enum_info, |
| 7398 | .get = alc883_mux_enum_get, |
| 7399 | .put = alc883_mux_enum_put, |
| 7400 | }, |
| 7401 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7402 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7403 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7404 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7405 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7406 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7407 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7408 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7409 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7410 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7411 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7412 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7413 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7414 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7415 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7416 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7417 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7418 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7419 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7420 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7421 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7422 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7423 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7424 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7425 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7426 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7427 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7428 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7429 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7430 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7431 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7432 | { |
| 7433 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7434 | /* .name = "Capture Source", */ |
| 7435 | .name = "Input Source", |
| 7436 | .count = 2, |
| 7437 | .info = alc883_mux_enum_info, |
| 7438 | .get = alc883_mux_enum_get, |
| 7439 | .put = alc883_mux_enum_put, |
| 7440 | }, |
| 7441 | { } /* end */ |
| 7442 | }; |
| 7443 | |
| 7444 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7445 | .ops = &snd_hda_bind_vol, |
| 7446 | .values = { |
| 7447 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7448 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7449 | 0 |
| 7450 | }, |
| 7451 | }; |
| 7452 | |
| 7453 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7454 | .ops = &snd_hda_bind_sw, |
| 7455 | .values = { |
| 7456 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7457 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7458 | 0 |
| 7459 | }, |
| 7460 | }; |
| 7461 | |
| 7462 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7463 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7464 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7465 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7466 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7467 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7468 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7469 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7470 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7471 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7472 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7473 | { |
| 7474 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7475 | /* .name = "Capture Source", */ |
| 7476 | .name = "Input Source", |
| 7477 | .count = 1, |
| 7478 | .info = alc883_mux_enum_info, |
| 7479 | .get = alc883_mux_enum_get, |
| 7480 | .put = alc883_mux_enum_put, |
| 7481 | }, |
| 7482 | { } /* end */ |
| 7483 | }; |
| 7484 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7485 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7486 | { |
| 7487 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7488 | .name = "Channel Mode", |
| 7489 | .info = alc_ch_mode_info, |
| 7490 | .get = alc_ch_mode_get, |
| 7491 | .put = alc_ch_mode_put, |
| 7492 | }, |
| 7493 | { } /* end */ |
| 7494 | }; |
| 7495 | |
| 7496 | static struct hda_verb alc883_init_verbs[] = { |
| 7497 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7498 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7499 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7500 | /* ADC2: mute amp left and right */ |
| 7501 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7502 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7503 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7505 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7506 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7507 | /* Rear mixer */ |
| 7508 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7509 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7510 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7511 | /* CLFE mixer */ |
| 7512 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7513 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7514 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7515 | /* Side mixer */ |
| 7516 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7517 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7518 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7519 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7520 | /* mute analog input loopbacks */ |
| 7521 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7522 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7523 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7524 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7525 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7526 | |
| 7527 | /* Front Pin: output 0 (0x0c) */ |
| 7528 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7529 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7530 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7531 | /* Rear Pin: output 1 (0x0d) */ |
| 7532 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7533 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7534 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7535 | /* CLFE Pin: output 2 (0x0e) */ |
| 7536 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7537 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7538 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7539 | /* Side Pin: output 3 (0x0f) */ |
| 7540 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7541 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7542 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7543 | /* Mic (rear) pin: input vref at 80% */ |
| 7544 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7545 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7546 | /* Front Mic pin: input vref at 80% */ |
| 7547 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7548 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7549 | /* Line In pin: input */ |
| 7550 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7551 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7552 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7553 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7554 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7555 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7556 | /* CD pin widget for input */ |
| 7557 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7558 | |
| 7559 | /* FIXME: use matrix-type input source selection */ |
| 7560 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7561 | /* Input mixer2 */ |
| 7562 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7563 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7564 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7565 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7566 | /* Input mixer3 */ |
| 7567 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7568 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7569 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7570 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7571 | { } |
| 7572 | }; |
| 7573 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7574 | /* toggle speaker-output according to the hp-jack state */ |
| 7575 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7576 | { |
| 7577 | unsigned int present; |
| 7578 | |
| 7579 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7580 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7581 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7582 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7583 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7584 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7585 | } |
| 7586 | |
| 7587 | /* auto-toggle front mic */ |
| 7588 | /* |
| 7589 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7590 | { |
| 7591 | unsigned int present; |
| 7592 | unsigned char bits; |
| 7593 | |
| 7594 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7595 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7596 | bits = present ? HDA_AMP_MUTE : 0; |
| 7597 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7598 | } |
| 7599 | */ |
| 7600 | |
| 7601 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7602 | { |
| 7603 | alc883_mitac_hp_automute(codec); |
| 7604 | /* alc883_mitac_mic_automute(codec); */ |
| 7605 | } |
| 7606 | |
| 7607 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7608 | unsigned int res) |
| 7609 | { |
| 7610 | switch (res >> 26) { |
| 7611 | case ALC880_HP_EVENT: |
| 7612 | alc883_mitac_hp_automute(codec); |
| 7613 | break; |
| 7614 | case ALC880_MIC_EVENT: |
| 7615 | /* alc883_mitac_mic_automute(codec); */ |
| 7616 | break; |
| 7617 | } |
| 7618 | } |
| 7619 | |
| 7620 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7621 | /* HP */ |
| 7622 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7623 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7624 | /* Subwoofer */ |
| 7625 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7626 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7627 | |
| 7628 | /* enable unsolicited event */ |
| 7629 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7630 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7631 | |
| 7632 | { } /* end */ |
| 7633 | }; |
| 7634 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7635 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7636 | /* HP */ |
| 7637 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7638 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7639 | /* Int speaker */ |
| 7640 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7641 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7642 | |
| 7643 | /* enable unsolicited event */ |
| 7644 | {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] | 7645 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7646 | |
| 7647 | { } /* end */ |
| 7648 | }; |
| 7649 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7650 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7651 | /* HP */ |
| 7652 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7653 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7654 | /* Subwoofer */ |
| 7655 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7656 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7657 | |
| 7658 | /* enable unsolicited event */ |
| 7659 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7660 | |
| 7661 | { } /* end */ |
| 7662 | }; |
| 7663 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7664 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7665 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7666 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7667 | |
| 7668 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7669 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7670 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7671 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7672 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7673 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7674 | |
| 7675 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7676 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7677 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7678 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7679 | |
| 7680 | { } /* end */ |
| 7681 | }; |
| 7682 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7683 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7684 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7685 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7686 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7687 | { } /* end */ |
| 7688 | }; |
| 7689 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7690 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7691 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7692 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7693 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7694 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7695 | { } /* end */ |
| 7696 | }; |
| 7697 | |
| 7698 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7699 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7700 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7701 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7702 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7703 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7704 | { } /* end */ |
| 7705 | }; |
| 7706 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7707 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7708 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7709 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7710 | |
| 7711 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7712 | |
| 7713 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7714 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7715 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7716 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7717 | { } /* end */ |
| 7718 | }; |
| 7719 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7720 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 7721 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7722 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7723 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7724 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7725 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7726 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7727 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7728 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7729 | { } /* end */ |
| 7730 | }; |
| 7731 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7732 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7733 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7734 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7735 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7736 | { } |
| 7737 | }; |
| 7738 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7739 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7740 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7741 | { } |
| 7742 | }; |
| 7743 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7744 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7745 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7746 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7747 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7748 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7749 | { } |
| 7750 | }; |
| 7751 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7752 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7753 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7754 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7755 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7756 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7757 | { } |
| 7758 | }; |
| 7759 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7760 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7761 | { 2, alc888_3st_hp_2ch_init }, |
| 7762 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7763 | }; |
| 7764 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7765 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7766 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7767 | { |
| 7768 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7769 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7770 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7771 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7772 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7773 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7774 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7775 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7776 | } |
| 7777 | |
| 7778 | /* toggle RCA according to the front-jack state */ |
| 7779 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7780 | { |
| 7781 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7782 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7783 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7784 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7785 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7786 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7787 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7788 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7789 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7790 | unsigned int res) |
| 7791 | { |
| 7792 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7793 | alc888_lenovo_ms7195_front_automute(codec); |
| 7794 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7795 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7796 | } |
| 7797 | |
| 7798 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7799 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7800 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7801 | |
| 7802 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7803 | |
| 7804 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7805 | { } /* end */ |
| 7806 | }; |
| 7807 | |
| 7808 | /* toggle speaker-output according to the hp-jack state */ |
| 7809 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7810 | { |
| 7811 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7812 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7813 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7814 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7815 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7816 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7817 | } |
| 7818 | |
| 7819 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7820 | unsigned int res) |
| 7821 | { |
| 7822 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7823 | alc883_medion_md2_automute(codec); |
| 7824 | } |
| 7825 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7826 | /* toggle speaker-output according to the hp-jack state */ |
| 7827 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7828 | { |
| 7829 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7830 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7831 | |
| 7832 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7833 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7834 | bits = present ? HDA_AMP_MUTE : 0; |
| 7835 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7836 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7837 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7838 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7839 | } |
| 7840 | |
| 7841 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7842 | { |
| 7843 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7844 | alc883_tagra_automute(codec); |
| 7845 | } |
| 7846 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7847 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7848 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7849 | { |
| 7850 | unsigned int present; |
| 7851 | unsigned char bits; |
| 7852 | |
| 7853 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7854 | & AC_PINSENSE_PRESENCE; |
| 7855 | bits = present ? HDA_AMP_MUTE : 0; |
| 7856 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7857 | HDA_AMP_MUTE, bits); |
| 7858 | } |
| 7859 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7860 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7861 | { |
| 7862 | unsigned int present; |
| 7863 | |
| 7864 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7865 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7866 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7867 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7868 | } |
| 7869 | |
| 7870 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7871 | { |
| 7872 | alc883_clevo_m720_hp_automute(codec); |
| 7873 | alc883_clevo_m720_mic_automute(codec); |
| 7874 | } |
| 7875 | |
| 7876 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7877 | unsigned int res) |
| 7878 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7879 | switch (res >> 26) { |
| 7880 | case ALC880_HP_EVENT: |
| 7881 | alc883_clevo_m720_hp_automute(codec); |
| 7882 | break; |
| 7883 | case ALC880_MIC_EVENT: |
| 7884 | alc883_clevo_m720_mic_automute(codec); |
| 7885 | break; |
| 7886 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7887 | } |
| 7888 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7889 | /* toggle speaker-output according to the hp-jack state */ |
| 7890 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7891 | { |
| 7892 | unsigned int present; |
| 7893 | unsigned char bits; |
| 7894 | |
| 7895 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7896 | & AC_PINSENSE_PRESENCE; |
| 7897 | bits = present ? HDA_AMP_MUTE : 0; |
| 7898 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7899 | HDA_AMP_MUTE, bits); |
| 7900 | } |
| 7901 | |
| 7902 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7903 | unsigned int res) |
| 7904 | { |
| 7905 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7906 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7907 | } |
| 7908 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7909 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7910 | { |
| 7911 | unsigned int present; |
| 7912 | unsigned char bits; |
| 7913 | |
| 7914 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7915 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7916 | bits = present ? 0x80 : 0; |
| 7917 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7918 | 0x80, bits); |
| 7919 | } |
| 7920 | |
| 7921 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7922 | unsigned int res) |
| 7923 | { |
| 7924 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7925 | alc883_haier_w66_automute(codec); |
| 7926 | } |
| 7927 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7928 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7929 | { |
| 7930 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7931 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7932 | |
| 7933 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7934 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7935 | bits = present ? HDA_AMP_MUTE : 0; |
| 7936 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7937 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7938 | } |
| 7939 | |
| 7940 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7941 | { |
| 7942 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7943 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7944 | |
| 7945 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7946 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7947 | bits = present ? HDA_AMP_MUTE : 0; |
| 7948 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7949 | HDA_AMP_MUTE, bits); |
| 7950 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7951 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7952 | } |
| 7953 | |
| 7954 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7955 | unsigned int res) |
| 7956 | { |
| 7957 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7958 | alc883_lenovo_101e_all_automute(codec); |
| 7959 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7960 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7961 | } |
| 7962 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7963 | /* toggle speaker-output according to the hp-jack state */ |
| 7964 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7965 | { |
| 7966 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7967 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7968 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7969 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7970 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7971 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7972 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7973 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7974 | } |
| 7975 | |
| 7976 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7977 | unsigned int res) |
| 7978 | { |
| 7979 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7980 | alc883_acer_aspire_automute(codec); |
| 7981 | } |
| 7982 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7983 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7984 | /* HP Pin: output 0 (0x0c) */ |
| 7985 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7986 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7987 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7988 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7989 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7990 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7991 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7992 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7993 | /* eanable EAPD on medion laptop */ |
| 7994 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7995 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7996 | /* enable unsolicited event */ |
| 7997 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7998 | { } |
| 7999 | }; |
| 8000 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8001 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 8002 | { |
| 8003 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8004 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8005 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8006 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8007 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8008 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8009 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8010 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8011 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8012 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8013 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8014 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8015 | } |
| 8016 | |
| 8017 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 8018 | unsigned int res) |
| 8019 | { |
| 8020 | switch (res >> 26) { |
| 8021 | case ALC880_HP_EVENT: |
| 8022 | printk("hp_event\n"); |
| 8023 | alc888_6st_dell_front_automute(codec); |
| 8024 | break; |
| 8025 | } |
| 8026 | } |
| 8027 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8028 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 8029 | { |
| 8030 | unsigned int mute; |
| 8031 | unsigned int present; |
| 8032 | |
| 8033 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8034 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8035 | AC_VERB_GET_PIN_SENSE, 0); |
| 8036 | present = (present & 0x80000000) != 0; |
| 8037 | if (present) { |
| 8038 | /* mute internal speaker */ |
| 8039 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8040 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8041 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8042 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8043 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8044 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8045 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8046 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8047 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8048 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8049 | } else { |
| 8050 | /* unmute internal speaker if necessary */ |
| 8051 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8052 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8053 | HDA_AMP_MUTE, mute); |
| 8054 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8055 | HDA_AMP_MUTE, mute); |
| 8056 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8057 | HDA_AMP_MUTE, mute); |
| 8058 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8059 | HDA_AMP_MUTE, mute); |
| 8060 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8061 | HDA_AMP_MUTE, mute); |
| 8062 | } |
| 8063 | } |
| 8064 | |
| 8065 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 8066 | unsigned int res) |
| 8067 | { |
| 8068 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8069 | alc888_lenovo_sky_front_automute(codec); |
| 8070 | } |
| 8071 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8072 | /* |
| 8073 | * generic initialization of ADC, input mixers and output mixers |
| 8074 | */ |
| 8075 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8076 | /* |
| 8077 | * Unmute ADC0-2 and set the default input to mic-in |
| 8078 | */ |
| 8079 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8080 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8081 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8082 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8083 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8084 | /* 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] | 8085 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8086 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8087 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8088 | */ |
| 8089 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8090 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8091 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8092 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8093 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8094 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8095 | |
| 8096 | /* |
| 8097 | * Set up output mixers (0x0c - 0x0f) |
| 8098 | */ |
| 8099 | /* set vol=0 to output mixers */ |
| 8100 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8101 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8102 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8103 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8104 | /* set up input amps for analog loopback */ |
| 8105 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8106 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8108 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8109 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8110 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8111 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8112 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8113 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8114 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8115 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8116 | |
| 8117 | /* FIXME: use matrix-type input source selection */ |
| 8118 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8119 | /* Input mixer1 */ |
| 8120 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8121 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8122 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8123 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8124 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8125 | /* Input mixer2 */ |
| 8126 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8127 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8128 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8129 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8130 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8131 | |
| 8132 | { } |
| 8133 | }; |
| 8134 | |
| 8135 | /* capture mixer elements */ |
| 8136 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 8137 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8138 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8139 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 8140 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 8141 | { |
| 8142 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8143 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8144 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8145 | */ |
| 8146 | /* .name = "Capture Source", */ |
| 8147 | .name = "Input Source", |
| 8148 | .count = 2, |
| 8149 | .info = alc882_mux_enum_info, |
| 8150 | .get = alc882_mux_enum_get, |
| 8151 | .put = alc882_mux_enum_put, |
| 8152 | }, |
| 8153 | { } /* end */ |
| 8154 | }; |
| 8155 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8156 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8157 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8158 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8159 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8160 | /* enable unsolicited event */ |
| 8161 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8162 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8163 | { } /* end */ |
| 8164 | }; |
| 8165 | |
| 8166 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8167 | { |
| 8168 | unsigned int present; |
| 8169 | |
| 8170 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8171 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8172 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8173 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8174 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8175 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8176 | } |
| 8177 | |
| 8178 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8179 | { |
| 8180 | unsigned int present; |
| 8181 | unsigned char bits; |
| 8182 | |
| 8183 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8184 | AC_VERB_GET_PIN_SENSE, 0) |
| 8185 | & AC_PINSENSE_PRESENCE; |
| 8186 | bits = present ? 0 : PIN_OUT; |
| 8187 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8188 | bits); |
| 8189 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8190 | bits); |
| 8191 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8192 | bits); |
| 8193 | } |
| 8194 | |
| 8195 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8196 | unsigned int res) |
| 8197 | { |
| 8198 | switch (res >> 26) { |
| 8199 | case ALC880_HP_EVENT: |
| 8200 | alc883_M90V_speaker_automute(codec); |
| 8201 | break; |
| 8202 | case ALC880_MIC_EVENT: |
| 8203 | alc883_nb_mic_automute(codec); |
| 8204 | break; |
| 8205 | } |
| 8206 | } |
| 8207 | |
| 8208 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8209 | { |
| 8210 | alc883_M90V_speaker_automute(codec); |
| 8211 | alc883_nb_mic_automute(codec); |
| 8212 | } |
| 8213 | |
| 8214 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8215 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8216 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8217 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8218 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8219 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8220 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8221 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8222 | /* enable unsolicited event */ |
| 8223 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8224 | { } /* end */ |
| 8225 | }; |
| 8226 | |
| 8227 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8228 | { |
| 8229 | unsigned int present; |
| 8230 | unsigned char bits; |
| 8231 | |
| 8232 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8233 | AC_VERB_GET_PIN_SENSE, 0) |
| 8234 | & AC_PINSENSE_PRESENCE; |
| 8235 | bits = present ? 0 : PIN_OUT; |
| 8236 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8237 | bits); |
| 8238 | } |
| 8239 | |
| 8240 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8241 | unsigned int res) |
| 8242 | { |
| 8243 | switch (res >> 26) { |
| 8244 | case ALC880_HP_EVENT: |
| 8245 | alc883_eee1601_speaker_automute(codec); |
| 8246 | break; |
| 8247 | } |
| 8248 | } |
| 8249 | |
| 8250 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8251 | { |
| 8252 | alc883_eee1601_speaker_automute(codec); |
| 8253 | } |
| 8254 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8255 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8256 | #define alc883_loopbacks alc880_loopbacks |
| 8257 | #endif |
| 8258 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8259 | /* pcm configuration: identiacal with ALC880 */ |
| 8260 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8261 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8262 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8263 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8264 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8265 | |
| 8266 | /* |
| 8267 | * configuration and preset |
| 8268 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8269 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8270 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8271 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8272 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8273 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8274 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8275 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8276 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8277 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8278 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8279 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8280 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8281 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8282 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8283 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8284 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8285 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8286 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8287 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8288 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8289 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8290 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8291 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8292 | [ALC883_AUTO] = "auto", |
| 8293 | }; |
| 8294 | |
| 8295 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8296 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8297 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 8298 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8299 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8300 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8301 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8302 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8303 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8304 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8305 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8306 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8307 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8308 | SND_PCI_QUIRK(0x1043, 0x8317, "Asus M90V", ALC888_ASUS_M90V), |
| 8309 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8310 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8311 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8312 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8313 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8314 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8315 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8316 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8317 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8318 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8319 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8320 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8321 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8322 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8323 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8324 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8325 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8326 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8327 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8328 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8329 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8330 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8331 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8332 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8333 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8334 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8335 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8336 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8337 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8338 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8339 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8340 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8341 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8342 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8343 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8344 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8345 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8346 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8347 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8348 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8349 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8350 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8351 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8352 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8353 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8354 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8355 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8356 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8357 | {} |
| 8358 | }; |
| 8359 | |
| 8360 | static struct alc_config_preset alc883_presets[] = { |
| 8361 | [ALC883_3ST_2ch_DIG] = { |
| 8362 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8363 | .init_verbs = { alc883_init_verbs }, |
| 8364 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8365 | .dac_nids = alc883_dac_nids, |
| 8366 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8367 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8368 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8369 | .channel_mode = alc883_3ST_2ch_modes, |
| 8370 | .input_mux = &alc883_capture_source, |
| 8371 | }, |
| 8372 | [ALC883_3ST_6ch_DIG] = { |
| 8373 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8374 | .init_verbs = { alc883_init_verbs }, |
| 8375 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8376 | .dac_nids = alc883_dac_nids, |
| 8377 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8378 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8379 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8380 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8381 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8382 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8383 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8384 | [ALC883_3ST_6ch] = { |
| 8385 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8386 | .init_verbs = { alc883_init_verbs }, |
| 8387 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8388 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8389 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8390 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8391 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8392 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8393 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8394 | [ALC883_3ST_6ch_INTEL] = { |
| 8395 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8396 | .init_verbs = { alc883_init_verbs }, |
| 8397 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8398 | .dac_nids = alc883_dac_nids, |
| 8399 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8400 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8401 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8402 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8403 | .need_dac_fix = 1, |
| 8404 | .input_mux = &alc883_3stack_6ch_intel, |
| 8405 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8406 | [ALC883_6ST_DIG] = { |
| 8407 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8408 | .init_verbs = { alc883_init_verbs }, |
| 8409 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8410 | .dac_nids = alc883_dac_nids, |
| 8411 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8412 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8413 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8414 | .channel_mode = alc883_sixstack_modes, |
| 8415 | .input_mux = &alc883_capture_source, |
| 8416 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8417 | [ALC883_TARGA_DIG] = { |
| 8418 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8419 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8420 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8421 | .dac_nids = alc883_dac_nids, |
| 8422 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8423 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8424 | .channel_mode = alc883_3ST_6ch_modes, |
| 8425 | .need_dac_fix = 1, |
| 8426 | .input_mux = &alc883_capture_source, |
| 8427 | .unsol_event = alc883_tagra_unsol_event, |
| 8428 | .init_hook = alc883_tagra_automute, |
| 8429 | }, |
| 8430 | [ALC883_TARGA_2ch_DIG] = { |
| 8431 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8432 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8433 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8434 | .dac_nids = alc883_dac_nids, |
| 8435 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8436 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8437 | .channel_mode = alc883_3ST_2ch_modes, |
| 8438 | .input_mux = &alc883_capture_source, |
| 8439 | .unsol_event = alc883_tagra_unsol_event, |
| 8440 | .init_hook = alc883_tagra_automute, |
| 8441 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8442 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8443 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8444 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8445 | * and the headphone jack. Turn this on and rely on the |
| 8446 | * standard mute methods whenever the user wants to turn |
| 8447 | * these outputs off. |
| 8448 | */ |
| 8449 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8450 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8451 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8452 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8453 | .channel_mode = alc883_3ST_2ch_modes, |
| 8454 | .input_mux = &alc883_capture_source, |
| 8455 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8456 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8457 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8458 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8459 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8460 | .dac_nids = alc883_dac_nids, |
| 8461 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8462 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8463 | .channel_mode = alc883_3ST_2ch_modes, |
| 8464 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8465 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8466 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8467 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8468 | [ALC883_MEDION] = { |
| 8469 | .mixers = { alc883_fivestack_mixer, |
| 8470 | alc883_chmode_mixer }, |
| 8471 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8472 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8473 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8474 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8475 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8476 | .channel_mode = alc883_sixstack_modes, |
| 8477 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8478 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8479 | [ALC883_MEDION_MD2] = { |
| 8480 | .mixers = { alc883_medion_md2_mixer}, |
| 8481 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8482 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8483 | .dac_nids = alc883_dac_nids, |
| 8484 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8485 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8486 | .channel_mode = alc883_3ST_2ch_modes, |
| 8487 | .input_mux = &alc883_capture_source, |
| 8488 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8489 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8490 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8491 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8492 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8493 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8494 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8495 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8496 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8497 | .channel_mode = alc883_3ST_2ch_modes, |
| 8498 | .input_mux = &alc883_capture_source, |
| 8499 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8500 | [ALC883_CLEVO_M720] = { |
| 8501 | .mixers = { alc883_clevo_m720_mixer }, |
| 8502 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8503 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8504 | .dac_nids = alc883_dac_nids, |
| 8505 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8506 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8507 | .channel_mode = alc883_3ST_2ch_modes, |
| 8508 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8509 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8510 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8511 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8512 | [ALC883_LENOVO_101E_2ch] = { |
| 8513 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8514 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8515 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8516 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8517 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8518 | .channel_mode = alc883_3ST_2ch_modes, |
| 8519 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8520 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8521 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8522 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8523 | [ALC883_LENOVO_NB0763] = { |
| 8524 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8525 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8526 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8527 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8528 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8529 | .channel_mode = alc883_3ST_2ch_modes, |
| 8530 | .need_dac_fix = 1, |
| 8531 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8532 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8533 | .init_hook = alc883_medion_md2_automute, |
| 8534 | }, |
| 8535 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8536 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8537 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8538 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8539 | .dac_nids = alc883_dac_nids, |
| 8540 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8541 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8542 | .channel_mode = alc883_3ST_6ch_modes, |
| 8543 | .need_dac_fix = 1, |
| 8544 | .input_mux = &alc883_capture_source, |
| 8545 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8546 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8547 | }, |
| 8548 | [ALC883_HAIER_W66] = { |
| 8549 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8550 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8551 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8552 | .dac_nids = alc883_dac_nids, |
| 8553 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8554 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8555 | .channel_mode = alc883_3ST_2ch_modes, |
| 8556 | .input_mux = &alc883_capture_source, |
| 8557 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8558 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8559 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8560 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8561 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8562 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8563 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8564 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8565 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8566 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8567 | .need_dac_fix = 1, |
| 8568 | .input_mux = &alc883_capture_source, |
| 8569 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8570 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8571 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8572 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8573 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8574 | .dac_nids = alc883_dac_nids, |
| 8575 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8576 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8577 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8578 | .channel_mode = alc883_sixstack_modes, |
| 8579 | .input_mux = &alc883_capture_source, |
| 8580 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8581 | .init_hook = alc888_6st_dell_front_automute, |
| 8582 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8583 | [ALC883_MITAC] = { |
| 8584 | .mixers = { alc883_mitac_mixer }, |
| 8585 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8586 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8587 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8588 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8589 | .channel_mode = alc883_3ST_2ch_modes, |
| 8590 | .input_mux = &alc883_capture_source, |
| 8591 | .unsol_event = alc883_mitac_unsol_event, |
| 8592 | .init_hook = alc883_mitac_automute, |
| 8593 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8594 | [ALC883_FUJITSU_PI2515] = { |
| 8595 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8596 | .init_verbs = { alc883_init_verbs, |
| 8597 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8598 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8599 | .dac_nids = alc883_dac_nids, |
| 8600 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8601 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8602 | .channel_mode = alc883_3ST_2ch_modes, |
| 8603 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8604 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8605 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8606 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8607 | [ALC888_LENOVO_SKY] = { |
| 8608 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 8609 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 8610 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8611 | .dac_nids = alc883_dac_nids, |
| 8612 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8613 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 8614 | .adc_nids = alc883_adc_nids, |
| 8615 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8616 | .channel_mode = alc883_sixstack_modes, |
| 8617 | .need_dac_fix = 1, |
| 8618 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 8619 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 8620 | .init_hook = alc888_lenovo_sky_front_automute, |
| 8621 | }, |
| 8622 | [ALC888_ASUS_M90V] = { |
| 8623 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8624 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 8625 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8626 | .dac_nids = alc883_dac_nids, |
| 8627 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8628 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8629 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8630 | .channel_mode = alc883_3ST_6ch_modes, |
| 8631 | .need_dac_fix = 1, |
| 8632 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8633 | .unsol_event = alc883_mode2_unsol_event, |
| 8634 | .init_hook = alc883_mode2_inithook, |
| 8635 | }, |
| 8636 | [ALC888_ASUS_EEE1601] = { |
| 8637 | .mixers = { alc883_asus_eee1601_mixer }, |
| 8638 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 8639 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8640 | .dac_nids = alc883_dac_nids, |
| 8641 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8642 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8643 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8644 | .channel_mode = alc883_3ST_2ch_modes, |
| 8645 | .need_dac_fix = 1, |
| 8646 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 8647 | .unsol_event = alc883_eee1601_unsol_event, |
| 8648 | .init_hook = alc883_eee1601_inithook, |
| 8649 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8650 | }; |
| 8651 | |
| 8652 | |
| 8653 | /* |
| 8654 | * BIOS auto configuration |
| 8655 | */ |
| 8656 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8657 | hda_nid_t nid, int pin_type, |
| 8658 | int dac_idx) |
| 8659 | { |
| 8660 | /* set as output */ |
| 8661 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8662 | int idx; |
| 8663 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8664 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8665 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8666 | idx = 4; |
| 8667 | else |
| 8668 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8669 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8670 | |
| 8671 | } |
| 8672 | |
| 8673 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8674 | { |
| 8675 | struct alc_spec *spec = codec->spec; |
| 8676 | int i; |
| 8677 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8678 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8679 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8680 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8681 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8682 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8683 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8684 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8685 | } |
| 8686 | } |
| 8687 | |
| 8688 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8689 | { |
| 8690 | struct alc_spec *spec = codec->spec; |
| 8691 | hda_nid_t pin; |
| 8692 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8693 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8694 | if (pin) /* connect to front */ |
| 8695 | /* use dac 0 */ |
| 8696 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8697 | pin = spec->autocfg.speaker_pins[0]; |
| 8698 | if (pin) |
| 8699 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8700 | } |
| 8701 | |
| 8702 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8703 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8704 | |
| 8705 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8706 | { |
| 8707 | struct alc_spec *spec = codec->spec; |
| 8708 | int i; |
| 8709 | |
| 8710 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8711 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8712 | if (alc883_is_input_pin(nid)) { |
| 8713 | snd_hda_codec_write(codec, nid, 0, |
| 8714 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8715 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8716 | PIN_VREF80 : PIN_IN)); |
| 8717 | if (nid != ALC883_PIN_CD_NID) |
| 8718 | snd_hda_codec_write(codec, nid, 0, |
| 8719 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8720 | AMP_OUT_MUTE); |
| 8721 | } |
| 8722 | } |
| 8723 | } |
| 8724 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8725 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 8726 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8727 | /* almost identical with ALC880 parser... */ |
| 8728 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8729 | { |
| 8730 | struct alc_spec *spec = codec->spec; |
| 8731 | int err = alc880_parse_auto_config(codec); |
| 8732 | |
| 8733 | if (err < 0) |
| 8734 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8735 | else if (!err) |
| 8736 | return 0; /* no config found */ |
| 8737 | |
| 8738 | err = alc_auto_add_mic_boost(codec); |
| 8739 | if (err < 0) |
| 8740 | return err; |
| 8741 | |
| 8742 | /* hack - override the init verbs */ |
| 8743 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8744 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8745 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8746 | |
| 8747 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8748 | } |
| 8749 | |
| 8750 | /* additional initialization for auto-configuration model */ |
| 8751 | static void alc883_auto_init(struct hda_codec *codec) |
| 8752 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8753 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8754 | alc883_auto_init_multi_out(codec); |
| 8755 | alc883_auto_init_hp_out(codec); |
| 8756 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8757 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8758 | if (spec->unsol_event) |
| 8759 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8760 | } |
| 8761 | |
| 8762 | static int patch_alc883(struct hda_codec *codec) |
| 8763 | { |
| 8764 | struct alc_spec *spec; |
| 8765 | int err, board_config; |
| 8766 | |
| 8767 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8768 | if (spec == NULL) |
| 8769 | return -ENOMEM; |
| 8770 | |
| 8771 | codec->spec = spec; |
| 8772 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 8773 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 8774 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8775 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8776 | alc883_models, |
| 8777 | alc883_cfg_tbl); |
| 8778 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8779 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8780 | "trying auto-probe from BIOS...\n"); |
| 8781 | board_config = ALC883_AUTO; |
| 8782 | } |
| 8783 | |
| 8784 | if (board_config == ALC883_AUTO) { |
| 8785 | /* automatic parse from the BIOS config */ |
| 8786 | err = alc883_parse_auto_config(codec); |
| 8787 | if (err < 0) { |
| 8788 | alc_free(codec); |
| 8789 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8790 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8791 | printk(KERN_INFO |
| 8792 | "hda_codec: Cannot set up configuration " |
| 8793 | "from BIOS. Using base mode...\n"); |
| 8794 | board_config = ALC883_3ST_2ch_DIG; |
| 8795 | } |
| 8796 | } |
| 8797 | |
| 8798 | if (board_config != ALC883_AUTO) |
| 8799 | setup_preset(spec, &alc883_presets[board_config]); |
| 8800 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8801 | switch (codec->vendor_id) { |
| 8802 | case 0x10ec0888: |
| 8803 | spec->stream_name_analog = "ALC888 Analog"; |
| 8804 | spec->stream_name_digital = "ALC888 Digital"; |
| 8805 | break; |
| 8806 | case 0x10ec0889: |
| 8807 | spec->stream_name_analog = "ALC889 Analog"; |
| 8808 | spec->stream_name_digital = "ALC889 Digital"; |
| 8809 | break; |
| 8810 | default: |
| 8811 | spec->stream_name_analog = "ALC883 Analog"; |
| 8812 | spec->stream_name_digital = "ALC883 Digital"; |
| 8813 | break; |
| 8814 | } |
| 8815 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8816 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8817 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8818 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8819 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8820 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8821 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8822 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8823 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8824 | spec->adc_nids = alc883_adc_nids; |
| 8825 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8826 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8827 | spec->vmaster_nid = 0x0c; |
| 8828 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8829 | codec->patch_ops = alc_patch_ops; |
| 8830 | if (board_config == ALC883_AUTO) |
| 8831 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 8832 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8833 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8834 | if (!spec->loopback.amplist) |
| 8835 | spec->loopback.amplist = alc883_loopbacks; |
| 8836 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8837 | |
| 8838 | return 0; |
| 8839 | } |
| 8840 | |
| 8841 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8842 | * ALC262 support |
| 8843 | */ |
| 8844 | |
| 8845 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8846 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8847 | |
| 8848 | #define alc262_dac_nids alc260_dac_nids |
| 8849 | #define alc262_adc_nids alc882_adc_nids |
| 8850 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8851 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8852 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8853 | |
| 8854 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8855 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8856 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 8857 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 8858 | /* ADC0 */ |
| 8859 | 0x09 |
| 8860 | }; |
| 8861 | |
| 8862 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 8863 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8864 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8865 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8866 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8867 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8868 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8869 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8870 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8871 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8872 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8873 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8874 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8875 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8876 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8877 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8878 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8879 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8880 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8881 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8882 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8883 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8884 | }; |
| 8885 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8886 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8887 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8888 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8889 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8890 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8891 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8892 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8893 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8894 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8895 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8896 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8897 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8898 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8899 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8900 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8901 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8902 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8903 | { } /* end */ |
| 8904 | }; |
| 8905 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8906 | /* update HP, line and mono-out pins according to the master switch */ |
| 8907 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8908 | { |
| 8909 | struct alc_spec *spec = codec->spec; |
| 8910 | int val = spec->master_sw; |
| 8911 | |
| 8912 | /* HP & line-out */ |
| 8913 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8914 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8915 | val ? PIN_HP : 0); |
| 8916 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8917 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8918 | val ? PIN_HP : 0); |
| 8919 | /* mono (speaker) depending on the HP jack sense */ |
| 8920 | val = val && !spec->jack_present; |
| 8921 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8922 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8923 | val ? PIN_OUT : 0); |
| 8924 | } |
| 8925 | |
| 8926 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8927 | { |
| 8928 | struct alc_spec *spec = codec->spec; |
| 8929 | unsigned int presence; |
| 8930 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8931 | AC_VERB_GET_PIN_SENSE, 0); |
| 8932 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8933 | alc262_hp_master_update(codec); |
| 8934 | } |
| 8935 | |
| 8936 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8937 | { |
| 8938 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8939 | return; |
| 8940 | alc262_hp_bpc_automute(codec); |
| 8941 | } |
| 8942 | |
| 8943 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8944 | { |
| 8945 | struct alc_spec *spec = codec->spec; |
| 8946 | unsigned int presence; |
| 8947 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8948 | AC_VERB_GET_PIN_SENSE, 0); |
| 8949 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8950 | alc262_hp_master_update(codec); |
| 8951 | } |
| 8952 | |
| 8953 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8954 | unsigned int res) |
| 8955 | { |
| 8956 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8957 | return; |
| 8958 | alc262_hp_wildwest_automute(codec); |
| 8959 | } |
| 8960 | |
| 8961 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8962 | struct snd_ctl_elem_value *ucontrol) |
| 8963 | { |
| 8964 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8965 | struct alc_spec *spec = codec->spec; |
| 8966 | *ucontrol->value.integer.value = spec->master_sw; |
| 8967 | return 0; |
| 8968 | } |
| 8969 | |
| 8970 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8971 | struct snd_ctl_elem_value *ucontrol) |
| 8972 | { |
| 8973 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8974 | struct alc_spec *spec = codec->spec; |
| 8975 | int val = !!*ucontrol->value.integer.value; |
| 8976 | |
| 8977 | if (val == spec->master_sw) |
| 8978 | return 0; |
| 8979 | spec->master_sw = val; |
| 8980 | alc262_hp_master_update(codec); |
| 8981 | return 1; |
| 8982 | } |
| 8983 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8984 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8985 | { |
| 8986 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8987 | .name = "Master Playback Switch", |
| 8988 | .info = snd_ctl_boolean_mono_info, |
| 8989 | .get = alc262_hp_master_sw_get, |
| 8990 | .put = alc262_hp_master_sw_put, |
| 8991 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8992 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8993 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8994 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8995 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8996 | HDA_OUTPUT), |
| 8997 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8998 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8999 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9000 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9001 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9002 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9003 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9004 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9005 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9006 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9007 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9008 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9009 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9010 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9011 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9012 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9013 | { } /* end */ |
| 9014 | }; |
| 9015 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9016 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9017 | { |
| 9018 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9019 | .name = "Master Playback Switch", |
| 9020 | .info = snd_ctl_boolean_mono_info, |
| 9021 | .get = alc262_hp_master_sw_get, |
| 9022 | .put = alc262_hp_master_sw_put, |
| 9023 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9024 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9025 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9026 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9027 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9028 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9029 | HDA_OUTPUT), |
| 9030 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9031 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9032 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9033 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9034 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9035 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9036 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9037 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9038 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9039 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9040 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9041 | { } /* end */ |
| 9042 | }; |
| 9043 | |
| 9044 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9045 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9046 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9047 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9048 | { } /* end */ |
| 9049 | }; |
| 9050 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9051 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9052 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 9053 | { |
| 9054 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9055 | |
| 9056 | if (force || !spec->sense_updated) { |
| 9057 | unsigned int present; |
| 9058 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9059 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9060 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9061 | spec->sense_updated = 1; |
| 9062 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9063 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 9064 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9065 | } |
| 9066 | |
| 9067 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9068 | unsigned int res) |
| 9069 | { |
| 9070 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9071 | return; |
| 9072 | alc262_hp_t5735_automute(codec, 1); |
| 9073 | } |
| 9074 | |
| 9075 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9076 | { |
| 9077 | alc262_hp_t5735_automute(codec, 1); |
| 9078 | } |
| 9079 | |
| 9080 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9081 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9082 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9083 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9084 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9085 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9086 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9087 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9088 | { } /* end */ |
| 9089 | }; |
| 9090 | |
| 9091 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9092 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9093 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9094 | |
| 9095 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9096 | { } |
| 9097 | }; |
| 9098 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9099 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9100 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9101 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9102 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9103 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9104 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9105 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9106 | { } /* end */ |
| 9107 | }; |
| 9108 | |
| 9109 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9110 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9111 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9112 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9113 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9114 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9115 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9116 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9117 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9118 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9119 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9120 | {} |
| 9121 | }; |
| 9122 | |
| 9123 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9124 | .num_items = 1, |
| 9125 | .items = { |
| 9126 | { "Line", 0x1 }, |
| 9127 | }, |
| 9128 | }; |
| 9129 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9130 | /* bind hp and internal speaker mute (with plug check) */ |
| 9131 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9132 | struct snd_ctl_elem_value *ucontrol) |
| 9133 | { |
| 9134 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9135 | long *valp = ucontrol->value.integer.value; |
| 9136 | int change; |
| 9137 | |
| 9138 | /* change hp mute */ |
| 9139 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9140 | HDA_AMP_MUTE, |
| 9141 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9142 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9143 | HDA_AMP_MUTE, |
| 9144 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9145 | if (change) { |
| 9146 | /* change speaker according to HP jack state */ |
| 9147 | struct alc_spec *spec = codec->spec; |
| 9148 | unsigned int mute; |
| 9149 | if (spec->jack_present) |
| 9150 | mute = HDA_AMP_MUTE; |
| 9151 | else |
| 9152 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9153 | HDA_OUTPUT, 0); |
| 9154 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9155 | HDA_AMP_MUTE, mute); |
| 9156 | } |
| 9157 | return change; |
| 9158 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9159 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9160 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9161 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9162 | { |
| 9163 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9164 | .name = "Master Playback Switch", |
| 9165 | .info = snd_hda_mixer_amp_switch_info, |
| 9166 | .get = snd_hda_mixer_amp_switch_get, |
| 9167 | .put = alc262_sony_master_sw_put, |
| 9168 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9169 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9170 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9171 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9172 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9173 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9174 | { } /* end */ |
| 9175 | }; |
| 9176 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9177 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9178 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9179 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9180 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9181 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9182 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9183 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9184 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9185 | { } /* end */ |
| 9186 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9187 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9188 | #define alc262_capture_mixer alc882_capture_mixer |
| 9189 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9190 | |
| 9191 | /* |
| 9192 | * generic initialization of ADC, input mixers and output mixers |
| 9193 | */ |
| 9194 | static struct hda_verb alc262_init_verbs[] = { |
| 9195 | /* |
| 9196 | * Unmute ADC0-2 and set the default input to mic-in |
| 9197 | */ |
| 9198 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9200 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9201 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9202 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9203 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9204 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9205 | /* 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] | 9206 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9207 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9208 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9209 | */ |
| 9210 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9211 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9212 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9213 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9214 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9215 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9216 | |
| 9217 | /* |
| 9218 | * Set up output mixers (0x0c - 0x0e) |
| 9219 | */ |
| 9220 | /* set vol=0 to output mixers */ |
| 9221 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9222 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9223 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9224 | /* set up input amps for analog loopback */ |
| 9225 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9227 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9228 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9229 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9230 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9231 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9232 | |
| 9233 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9234 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9235 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9236 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9237 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9238 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9239 | |
| 9240 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9241 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9242 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9243 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9244 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9245 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9246 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9247 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9249 | /* FIXME: use matrix-type input source selection */ |
| 9250 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9251 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9252 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9253 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9254 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9255 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9256 | /* Input mixer2 */ |
| 9257 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9258 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9259 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9261 | /* Input mixer3 */ |
| 9262 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9263 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9264 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9266 | |
| 9267 | { } |
| 9268 | }; |
| 9269 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9270 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9271 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9272 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9273 | { } |
| 9274 | }; |
| 9275 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9276 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9277 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9278 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9279 | {} |
| 9280 | }; |
| 9281 | |
| 9282 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9283 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9284 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9285 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9286 | |
| 9287 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9288 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9289 | {} |
| 9290 | }; |
| 9291 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9292 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9293 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9294 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9295 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9296 | |
| 9297 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9298 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9299 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9300 | }; |
| 9301 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9302 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9303 | .num_items = 2, |
| 9304 | .items = { |
| 9305 | { "Int DMic", 0x9 }, |
| 9306 | { "Mic", 0x0 }, |
| 9307 | }, |
| 9308 | }; |
| 9309 | |
| 9310 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9311 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9312 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9313 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9314 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9315 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9316 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9317 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9318 | { |
| 9319 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9320 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9321 | * So call somewhat different.. |
| 9322 | */ |
| 9323 | /* .name = "Capture Source", */ |
| 9324 | .name = "Input Source", |
| 9325 | .count = 1, |
| 9326 | .info = alc_mux_enum_info, |
| 9327 | .get = alc_mux_enum_get, |
| 9328 | .put = alc_mux_enum_put, |
| 9329 | }, |
| 9330 | { } /* end */ |
| 9331 | }; |
| 9332 | |
| 9333 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9334 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9335 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9337 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9338 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9339 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9340 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9341 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9342 | {} |
| 9343 | }; |
| 9344 | |
| 9345 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9346 | { |
| 9347 | unsigned int present; |
| 9348 | |
| 9349 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9350 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9351 | snd_hda_codec_write(codec, 0x22, 0, |
| 9352 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9353 | } |
| 9354 | |
| 9355 | /* toggle speaker-output according to the hp-jack state */ |
| 9356 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9357 | { |
| 9358 | unsigned int present; |
| 9359 | unsigned char bits; |
| 9360 | |
| 9361 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9362 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9363 | bits = present ? 0 : PIN_OUT; |
| 9364 | snd_hda_codec_write(codec, 0x14, 0, |
| 9365 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9366 | } |
| 9367 | |
| 9368 | |
| 9369 | |
| 9370 | /* unsolicited event for HP jack sensing */ |
| 9371 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9372 | unsigned int res) |
| 9373 | { |
| 9374 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9375 | alc262_toshiba_s06_speaker_automute(codec); |
| 9376 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9377 | alc262_dmic_automute(codec); |
| 9378 | |
| 9379 | } |
| 9380 | |
| 9381 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9382 | { |
| 9383 | alc262_toshiba_s06_speaker_automute(codec); |
| 9384 | alc262_dmic_automute(codec); |
| 9385 | } |
| 9386 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9387 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9388 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9389 | { |
| 9390 | struct alc_spec *spec = codec->spec; |
| 9391 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9392 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9393 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9394 | /* need to execute and sync at first */ |
| 9395 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9396 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9397 | AC_VERB_GET_PIN_SENSE, 0); |
| 9398 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9399 | if (spec->jack_present) { |
| 9400 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9401 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9402 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9403 | } else { |
| 9404 | /* unmute internal speaker if necessary */ |
| 9405 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9406 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9407 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9408 | } |
| 9409 | } |
| 9410 | |
| 9411 | /* unsolicited event for HP jack sensing */ |
| 9412 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9413 | unsigned int res) |
| 9414 | { |
| 9415 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9416 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9417 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9418 | } |
| 9419 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9420 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9421 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9422 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9423 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9424 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9425 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9426 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9427 | AC_VERB_GET_PIN_SENSE, 0); |
| 9428 | present = (present & 0x80000000) != 0; |
| 9429 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9430 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9431 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9432 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9433 | } else { |
| 9434 | /* unmute internal speaker if necessary */ |
| 9435 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9436 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9437 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9438 | } |
| 9439 | } |
| 9440 | |
| 9441 | /* unsolicited event for HP jack sensing */ |
| 9442 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9443 | unsigned int res) |
| 9444 | { |
| 9445 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9446 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9447 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9448 | } |
| 9449 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9450 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9451 | * nec model |
| 9452 | * 0x15 = headphone |
| 9453 | * 0x16 = internal speaker |
| 9454 | * 0x18 = external mic |
| 9455 | */ |
| 9456 | |
| 9457 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9458 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9459 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9460 | |
| 9461 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9462 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9463 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9464 | |
| 9465 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9466 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9467 | { } /* end */ |
| 9468 | }; |
| 9469 | |
| 9470 | static struct hda_verb alc262_nec_verbs[] = { |
| 9471 | /* Unmute Speaker */ |
| 9472 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9473 | |
| 9474 | /* Headphone */ |
| 9475 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9476 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9477 | |
| 9478 | /* External mic to headphone */ |
| 9479 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9480 | /* External mic to speaker */ |
| 9481 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9482 | {} |
| 9483 | }; |
| 9484 | |
| 9485 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9486 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9487 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9488 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9489 | */ |
| 9490 | |
| 9491 | #define ALC_HP_EVENT 0x37 |
| 9492 | |
| 9493 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9494 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9496 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9497 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9498 | {} |
| 9499 | }; |
| 9500 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9501 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9502 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9503 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9504 | {} |
| 9505 | }; |
| 9506 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9507 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9508 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9509 | .items = { |
| 9510 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9511 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9512 | { "CD", 0x4 }, |
| 9513 | }, |
| 9514 | }; |
| 9515 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9516 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9517 | .num_items = 5, |
| 9518 | .items = { |
| 9519 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9520 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9521 | { "Line", 0x2 }, |
| 9522 | { "CD", 0x4 }, |
| 9523 | { "AUX IN", 0x6 }, |
| 9524 | }, |
| 9525 | }; |
| 9526 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9527 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9528 | .num_items = 4, |
| 9529 | .items = { |
| 9530 | { "Mic", 0x0 }, |
| 9531 | { "Front Mic", 0x2 }, |
| 9532 | { "Line", 0x1 }, |
| 9533 | { "CD", 0x4 }, |
| 9534 | }, |
| 9535 | }; |
| 9536 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9537 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9538 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9539 | { |
| 9540 | struct alc_spec *spec = codec->spec; |
| 9541 | unsigned int mute; |
| 9542 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9543 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9544 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9545 | /* need to execute and sync at first */ |
| 9546 | 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] | 9547 | /* check laptop HP jack */ |
| 9548 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9549 | AC_VERB_GET_PIN_SENSE, 0); |
| 9550 | /* need to execute and sync at first */ |
| 9551 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9552 | /* check docking HP jack */ |
| 9553 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9554 | AC_VERB_GET_PIN_SENSE, 0); |
| 9555 | if (present & AC_PINSENSE_PRESENCE) |
| 9556 | spec->jack_present = 1; |
| 9557 | else |
| 9558 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9559 | spec->sense_updated = 1; |
| 9560 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9561 | /* unmute internal speaker only if both HPs are unplugged and |
| 9562 | * master switch is on |
| 9563 | */ |
| 9564 | if (spec->jack_present) |
| 9565 | mute = HDA_AMP_MUTE; |
| 9566 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9567 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9568 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9569 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9570 | } |
| 9571 | |
| 9572 | /* unsolicited event for HP jack sensing */ |
| 9573 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9574 | unsigned int res) |
| 9575 | { |
| 9576 | if ((res >> 26) != ALC_HP_EVENT) |
| 9577 | return; |
| 9578 | alc262_fujitsu_automute(codec, 1); |
| 9579 | } |
| 9580 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9581 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9582 | { |
| 9583 | alc262_fujitsu_automute(codec, 1); |
| 9584 | } |
| 9585 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9586 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9587 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 9588 | .ops = &snd_hda_bind_vol, |
| 9589 | .values = { |
| 9590 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 9591 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 9592 | 0 |
| 9593 | }, |
| 9594 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9595 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9596 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9597 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 9598 | { |
| 9599 | struct alc_spec *spec = codec->spec; |
| 9600 | unsigned int mute; |
| 9601 | |
| 9602 | if (force || !spec->sense_updated) { |
| 9603 | unsigned int present_int_hp; |
| 9604 | /* need to execute and sync at first */ |
| 9605 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9606 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 9607 | AC_VERB_GET_PIN_SENSE, 0); |
| 9608 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 9609 | spec->sense_updated = 1; |
| 9610 | } |
| 9611 | if (spec->jack_present) { |
| 9612 | /* mute internal speaker */ |
| 9613 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9614 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9615 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9616 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9617 | } else { |
| 9618 | /* unmute internal speaker if necessary */ |
| 9619 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9620 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9621 | HDA_AMP_MUTE, mute); |
| 9622 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9623 | HDA_AMP_MUTE, mute); |
| 9624 | } |
| 9625 | } |
| 9626 | |
| 9627 | /* unsolicited event for HP jack sensing */ |
| 9628 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 9629 | unsigned int res) |
| 9630 | { |
| 9631 | if ((res >> 26) != ALC_HP_EVENT) |
| 9632 | return; |
| 9633 | alc262_lenovo_3000_automute(codec, 1); |
| 9634 | } |
| 9635 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9636 | /* bind hp and internal speaker mute (with plug check) */ |
| 9637 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9638 | struct snd_ctl_elem_value *ucontrol) |
| 9639 | { |
| 9640 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9641 | long *valp = ucontrol->value.integer.value; |
| 9642 | int change; |
| 9643 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9644 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9645 | HDA_AMP_MUTE, |
| 9646 | valp ? 0 : HDA_AMP_MUTE); |
| 9647 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9648 | HDA_AMP_MUTE, |
| 9649 | valp ? 0 : HDA_AMP_MUTE); |
| 9650 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 9651 | if (change) |
| 9652 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9653 | return change; |
| 9654 | } |
| 9655 | |
| 9656 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9657 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9658 | { |
| 9659 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9660 | .name = "Master Playback Switch", |
| 9661 | .info = snd_hda_mixer_amp_switch_info, |
| 9662 | .get = snd_hda_mixer_amp_switch_get, |
| 9663 | .put = alc262_fujitsu_master_sw_put, |
| 9664 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9665 | }, |
| 9666 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9667 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 9668 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 9669 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9670 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9671 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9672 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9673 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9674 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9675 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9676 | { } /* end */ |
| 9677 | }; |
| 9678 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9679 | /* bind hp and internal speaker mute (with plug check) */ |
| 9680 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9681 | struct snd_ctl_elem_value *ucontrol) |
| 9682 | { |
| 9683 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9684 | long *valp = ucontrol->value.integer.value; |
| 9685 | int change; |
| 9686 | |
| 9687 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9688 | HDA_AMP_MUTE, |
| 9689 | valp ? 0 : HDA_AMP_MUTE); |
| 9690 | |
| 9691 | if (change) |
| 9692 | alc262_lenovo_3000_automute(codec, 0); |
| 9693 | return change; |
| 9694 | } |
| 9695 | |
| 9696 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 9697 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9698 | { |
| 9699 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9700 | .name = "Master Playback Switch", |
| 9701 | .info = snd_hda_mixer_amp_switch_info, |
| 9702 | .get = snd_hda_mixer_amp_switch_get, |
| 9703 | .put = alc262_lenovo_3000_master_sw_put, |
| 9704 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 9705 | }, |
| 9706 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9707 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9708 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9709 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9710 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9711 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9712 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9713 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9714 | { } /* end */ |
| 9715 | }; |
| 9716 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 9717 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 9718 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9719 | { |
| 9720 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9721 | .name = "Master Playback Switch", |
| 9722 | .info = snd_hda_mixer_amp_switch_info, |
| 9723 | .get = snd_hda_mixer_amp_switch_get, |
| 9724 | .put = alc262_sony_master_sw_put, |
| 9725 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9726 | }, |
| 9727 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9728 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9729 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9730 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9731 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9732 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9733 | { } /* end */ |
| 9734 | }; |
| 9735 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9736 | /* additional init verbs for Benq laptops */ |
| 9737 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 9738 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9739 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9740 | {} |
| 9741 | }; |
| 9742 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9743 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 9744 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9745 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9746 | |
| 9747 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9748 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 9749 | {} |
| 9750 | }; |
| 9751 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9752 | /* Samsung Q1 Ultra Vista model setup */ |
| 9753 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9754 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9755 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9756 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9757 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9758 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9759 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9760 | { } /* end */ |
| 9761 | }; |
| 9762 | |
| 9763 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9764 | /* output mixer */ |
| 9765 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9766 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9767 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9768 | /* speaker */ |
| 9769 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9770 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9771 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9772 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9773 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9774 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9775 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9776 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9777 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9778 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9779 | /* internal mic */ |
| 9780 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9781 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9782 | /* ADC, choose mic */ |
| 9783 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9784 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9785 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9786 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9787 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9788 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9789 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9790 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9791 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 9792 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9793 | {} |
| 9794 | }; |
| 9795 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9796 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9797 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9798 | { |
| 9799 | struct alc_spec *spec = codec->spec; |
| 9800 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9801 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9802 | mute = 0; |
| 9803 | /* auto-mute only when HP is used as HP */ |
| 9804 | if (!spec->cur_mux[0]) { |
| 9805 | unsigned int present; |
| 9806 | /* need to execute and sync at first */ |
| 9807 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9808 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9809 | AC_VERB_GET_PIN_SENSE, 0); |
| 9810 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9811 | if (spec->jack_present) |
| 9812 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9813 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9814 | /* mute/unmute internal speaker */ |
| 9815 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9816 | HDA_AMP_MUTE, mute); |
| 9817 | /* mute/unmute HP */ |
| 9818 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9819 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9820 | } |
| 9821 | |
| 9822 | /* unsolicited event for HP jack sensing */ |
| 9823 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9824 | unsigned int res) |
| 9825 | { |
| 9826 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9827 | return; |
| 9828 | alc262_ultra_automute(codec); |
| 9829 | } |
| 9830 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9831 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9832 | .num_items = 2, |
| 9833 | .items = { |
| 9834 | { "Mic", 0x1 }, |
| 9835 | { "Headphone", 0x7 }, |
| 9836 | }, |
| 9837 | }; |
| 9838 | |
| 9839 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9840 | struct snd_ctl_elem_value *ucontrol) |
| 9841 | { |
| 9842 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9843 | struct alc_spec *spec = codec->spec; |
| 9844 | int ret; |
| 9845 | |
| 9846 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 9847 | if (!ret) |
| 9848 | return 0; |
| 9849 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9850 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9851 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9852 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9853 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9854 | return ret; |
| 9855 | } |
| 9856 | |
| 9857 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9858 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9859 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9860 | { |
| 9861 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9862 | .name = "Capture Source", |
| 9863 | .info = alc882_mux_enum_info, |
| 9864 | .get = alc882_mux_enum_get, |
| 9865 | .put = alc262_ultra_mux_enum_put, |
| 9866 | }, |
| 9867 | { } /* end */ |
| 9868 | }; |
| 9869 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9870 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9871 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9872 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9873 | { |
| 9874 | hda_nid_t nid; |
| 9875 | int err; |
| 9876 | |
| 9877 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9878 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9879 | spec->multiout.dac_nids[0] = 2; |
| 9880 | |
| 9881 | nid = cfg->line_out_pins[0]; |
| 9882 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9883 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9884 | "Front Playback Volume", |
| 9885 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9886 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9887 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9888 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9889 | "Front Playback Switch", |
| 9890 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9891 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9892 | return err; |
| 9893 | } |
| 9894 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9895 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9896 | if (nid) { |
| 9897 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9898 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9899 | "Speaker Playback Volume", |
| 9900 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9901 | HDA_OUTPUT)); |
| 9902 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9903 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9904 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9905 | "Speaker Playback Switch", |
| 9906 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9907 | HDA_OUTPUT)); |
| 9908 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9909 | return err; |
| 9910 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9911 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9912 | "Speaker Playback Switch", |
| 9913 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9914 | HDA_OUTPUT)); |
| 9915 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9916 | return err; |
| 9917 | } |
| 9918 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9919 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9920 | if (nid) { |
| 9921 | /* spec->multiout.hp_nid = 2; */ |
| 9922 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9923 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9924 | "Headphone Playback Volume", |
| 9925 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9926 | HDA_OUTPUT)); |
| 9927 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9928 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9929 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9930 | "Headphone Playback Switch", |
| 9931 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9932 | HDA_OUTPUT)); |
| 9933 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9934 | return err; |
| 9935 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9936 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9937 | "Headphone Playback Switch", |
| 9938 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9939 | HDA_OUTPUT)); |
| 9940 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9941 | return err; |
| 9942 | } |
| 9943 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9944 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9945 | } |
| 9946 | |
| 9947 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9948 | #define alc262_auto_create_analog_input_ctls \ |
| 9949 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9950 | |
| 9951 | /* |
| 9952 | * generic initialization of ADC, input mixers and output mixers |
| 9953 | */ |
| 9954 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9955 | /* |
| 9956 | * Unmute ADC0-2 and set the default input to mic-in |
| 9957 | */ |
| 9958 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9959 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9960 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9961 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9962 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9963 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9964 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9965 | /* 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] | 9966 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9967 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9968 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9969 | */ |
| 9970 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9971 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9972 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9973 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9974 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9975 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9976 | |
| 9977 | /* |
| 9978 | * Set up output mixers (0x0c - 0x0f) |
| 9979 | */ |
| 9980 | /* set vol=0 to output mixers */ |
| 9981 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9982 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9983 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9984 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9985 | /* set up input amps for analog loopback */ |
| 9986 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9987 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9988 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9989 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9990 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9991 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9992 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9993 | |
| 9994 | /* FIXME: use matrix-type input source selection */ |
| 9995 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9996 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9997 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9998 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9999 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10000 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10001 | /* Input mixer2 */ |
| 10002 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10003 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10004 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10005 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10006 | /* Input mixer3 */ |
| 10007 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10008 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10009 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10010 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10011 | |
| 10012 | { } |
| 10013 | }; |
| 10014 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10015 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10016 | /* |
| 10017 | * Unmute ADC0-2 and set the default input to mic-in |
| 10018 | */ |
| 10019 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10020 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10021 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10022 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10023 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10024 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10025 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10026 | /* 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] | 10027 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10028 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10029 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10030 | */ |
| 10031 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10032 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10033 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10034 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10035 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10036 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10037 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10038 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10039 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10040 | /* |
| 10041 | * Set up output mixers (0x0c - 0x0e) |
| 10042 | */ |
| 10043 | /* set vol=0 to output mixers */ |
| 10044 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10045 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10046 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10047 | |
| 10048 | /* set up input amps for analog loopback */ |
| 10049 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10050 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10051 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10052 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10053 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10054 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10055 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10056 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10057 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10058 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10059 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10060 | |
| 10061 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10062 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10063 | |
| 10064 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10065 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10066 | |
| 10067 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10068 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10069 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10070 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10071 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10072 | |
| 10073 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10074 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10075 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10076 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10077 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10078 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10079 | |
| 10080 | |
| 10081 | /* FIXME: use matrix-type input source selection */ |
| 10082 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10083 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10084 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10085 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10086 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10087 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10088 | /* Input mixer2 */ |
| 10089 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10090 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10091 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10092 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10093 | /* Input mixer3 */ |
| 10094 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10095 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10096 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10097 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10098 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10099 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10100 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10101 | { } |
| 10102 | }; |
| 10103 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10104 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10105 | /* |
| 10106 | * Unmute ADC0-2 and set the default input to mic-in |
| 10107 | */ |
| 10108 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10109 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10110 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10111 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10112 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10113 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10114 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10115 | /* 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] | 10116 | * mixer widget |
| 10117 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10118 | * panel mic (mic 2) |
| 10119 | */ |
| 10120 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10121 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10122 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10123 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10124 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10125 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10126 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10127 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10129 | /* |
| 10130 | * Set up output mixers (0x0c - 0x0e) |
| 10131 | */ |
| 10132 | /* set vol=0 to output mixers */ |
| 10133 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10134 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10135 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10136 | |
| 10137 | /* set up input amps for analog loopback */ |
| 10138 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10139 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10140 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10141 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10142 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10143 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10144 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10145 | |
| 10146 | |
| 10147 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10148 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10149 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10150 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10151 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10152 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10153 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10154 | |
| 10155 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10156 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10157 | |
| 10158 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10159 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10160 | |
| 10161 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10162 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10163 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10164 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10165 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10166 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10167 | |
| 10168 | /* FIXME: use matrix-type input source selection */ |
| 10169 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10170 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10171 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10172 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10173 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10174 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10175 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10176 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10177 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10178 | /* Input mixer2 */ |
| 10179 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10180 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10181 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10182 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10183 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10184 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10185 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10186 | /* Input mixer3 */ |
| 10187 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10188 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10189 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10190 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10191 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10192 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10193 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10194 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10195 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10196 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10197 | { } |
| 10198 | }; |
| 10199 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10200 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10201 | |
| 10202 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10203 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10204 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10205 | |
| 10206 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10207 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10208 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10209 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10210 | |
| 10211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10212 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10213 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10214 | {} |
| 10215 | }; |
| 10216 | |
| 10217 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10218 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10219 | #define alc262_loopbacks alc880_loopbacks |
| 10220 | #endif |
| 10221 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10222 | /* pcm configuration: identiacal with ALC880 */ |
| 10223 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10224 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10225 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10226 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10227 | |
| 10228 | /* |
| 10229 | * BIOS auto configuration |
| 10230 | */ |
| 10231 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10232 | { |
| 10233 | struct alc_spec *spec = codec->spec; |
| 10234 | int err; |
| 10235 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10236 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10237 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10238 | alc262_ignore); |
| 10239 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10240 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10241 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10242 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10243 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10244 | if (err < 0) |
| 10245 | return err; |
| 10246 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10247 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10248 | return err; |
| 10249 | |
| 10250 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10251 | |
| 10252 | if (spec->autocfg.dig_out_pin) |
| 10253 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 10254 | if (spec->autocfg.dig_in_pin) |
| 10255 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10256 | |
| 10257 | if (spec->kctl_alloc) |
| 10258 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10259 | |
| 10260 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10261 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10262 | spec->input_mux = &spec->private_imux; |
| 10263 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10264 | err = alc_auto_add_mic_boost(codec); |
| 10265 | if (err < 0) |
| 10266 | return err; |
| 10267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10268 | return 1; |
| 10269 | } |
| 10270 | |
| 10271 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10272 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10273 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10274 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10275 | |
| 10276 | |
| 10277 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10278 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10279 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10280 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10281 | alc262_auto_init_multi_out(codec); |
| 10282 | alc262_auto_init_hp_out(codec); |
| 10283 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10284 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10285 | if (spec->unsol_event) |
| 10286 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10287 | } |
| 10288 | |
| 10289 | /* |
| 10290 | * configuration and preset |
| 10291 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10292 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10293 | [ALC262_BASIC] = "basic", |
| 10294 | [ALC262_HIPPO] = "hippo", |
| 10295 | [ALC262_HIPPO_1] = "hippo_1", |
| 10296 | [ALC262_FUJITSU] = "fujitsu", |
| 10297 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10298 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10299 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10300 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10301 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10302 | [ALC262_BENQ_T31] = "benq-t31", |
| 10303 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10304 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10305 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10306 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10307 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10308 | [ALC262_NEC] = "nec", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10309 | [ALC262_AUTO] = "auto", |
| 10310 | }; |
| 10311 | |
| 10312 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10313 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10314 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10315 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10316 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10317 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 10318 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10319 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10320 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10321 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10322 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10323 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10324 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10325 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10326 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10327 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10328 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10329 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10330 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10331 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10332 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10333 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10334 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10335 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10336 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10337 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10338 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10339 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10340 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10341 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10342 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10343 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10344 | SND_PCI_QUIRK(0x1179, 0x0268, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10345 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10346 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10347 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10348 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10349 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10350 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10351 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10352 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10353 | {} |
| 10354 | }; |
| 10355 | |
| 10356 | static struct alc_config_preset alc262_presets[] = { |
| 10357 | [ALC262_BASIC] = { |
| 10358 | .mixers = { alc262_base_mixer }, |
| 10359 | .init_verbs = { alc262_init_verbs }, |
| 10360 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10361 | .dac_nids = alc262_dac_nids, |
| 10362 | .hp_nid = 0x03, |
| 10363 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10364 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10365 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10366 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10367 | [ALC262_HIPPO] = { |
| 10368 | .mixers = { alc262_base_mixer }, |
| 10369 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10370 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10371 | .dac_nids = alc262_dac_nids, |
| 10372 | .hp_nid = 0x03, |
| 10373 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10374 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10375 | .channel_mode = alc262_modes, |
| 10376 | .input_mux = &alc262_capture_source, |
| 10377 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10378 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10379 | }, |
| 10380 | [ALC262_HIPPO_1] = { |
| 10381 | .mixers = { alc262_hippo1_mixer }, |
| 10382 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10383 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10384 | .dac_nids = alc262_dac_nids, |
| 10385 | .hp_nid = 0x02, |
| 10386 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10387 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10388 | .channel_mode = alc262_modes, |
| 10389 | .input_mux = &alc262_capture_source, |
| 10390 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10391 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10392 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10393 | [ALC262_FUJITSU] = { |
| 10394 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10395 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10396 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10397 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10398 | .dac_nids = alc262_dac_nids, |
| 10399 | .hp_nid = 0x03, |
| 10400 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10401 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10402 | .channel_mode = alc262_modes, |
| 10403 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10404 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10405 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10406 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10407 | [ALC262_HP_BPC] = { |
| 10408 | .mixers = { alc262_HP_BPC_mixer }, |
| 10409 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10410 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10411 | .dac_nids = alc262_dac_nids, |
| 10412 | .hp_nid = 0x03, |
| 10413 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10414 | .channel_mode = alc262_modes, |
| 10415 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10416 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10417 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10418 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10419 | [ALC262_HP_BPC_D7000_WF] = { |
| 10420 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10421 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10422 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10423 | .dac_nids = alc262_dac_nids, |
| 10424 | .hp_nid = 0x03, |
| 10425 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10426 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10427 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10428 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10429 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10430 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10431 | [ALC262_HP_BPC_D7000_WL] = { |
| 10432 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10433 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10434 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10435 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10436 | .dac_nids = alc262_dac_nids, |
| 10437 | .hp_nid = 0x03, |
| 10438 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10439 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10440 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10441 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10442 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10443 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10444 | [ALC262_HP_TC_T5735] = { |
| 10445 | .mixers = { alc262_hp_t5735_mixer }, |
| 10446 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10447 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10448 | .dac_nids = alc262_dac_nids, |
| 10449 | .hp_nid = 0x03, |
| 10450 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10451 | .channel_mode = alc262_modes, |
| 10452 | .input_mux = &alc262_capture_source, |
| 10453 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10454 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10455 | }, |
| 10456 | [ALC262_HP_RP5700] = { |
| 10457 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10458 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10459 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10460 | .dac_nids = alc262_dac_nids, |
| 10461 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10462 | .channel_mode = alc262_modes, |
| 10463 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10464 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10465 | [ALC262_BENQ_ED8] = { |
| 10466 | .mixers = { alc262_base_mixer }, |
| 10467 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10468 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10469 | .dac_nids = alc262_dac_nids, |
| 10470 | .hp_nid = 0x03, |
| 10471 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10472 | .channel_mode = alc262_modes, |
| 10473 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10474 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10475 | [ALC262_SONY_ASSAMD] = { |
| 10476 | .mixers = { alc262_sony_mixer }, |
| 10477 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10478 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10479 | .dac_nids = alc262_dac_nids, |
| 10480 | .hp_nid = 0x02, |
| 10481 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10482 | .channel_mode = alc262_modes, |
| 10483 | .input_mux = &alc262_capture_source, |
| 10484 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10485 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10486 | }, |
| 10487 | [ALC262_BENQ_T31] = { |
| 10488 | .mixers = { alc262_benq_t31_mixer }, |
| 10489 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10490 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10491 | .dac_nids = alc262_dac_nids, |
| 10492 | .hp_nid = 0x03, |
| 10493 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10494 | .channel_mode = alc262_modes, |
| 10495 | .input_mux = &alc262_capture_source, |
| 10496 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10497 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10498 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10499 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10500 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 10501 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10502 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10503 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10504 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10505 | .channel_mode = alc262_modes, |
| 10506 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10507 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10508 | .capsrc_nids = alc262_capsrc_nids, |
| 10509 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10510 | .unsol_event = alc262_ultra_unsol_event, |
| 10511 | .init_hook = alc262_ultra_automute, |
| 10512 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10513 | [ALC262_LENOVO_3000] = { |
| 10514 | .mixers = { alc262_lenovo_3000_mixer }, |
| 10515 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10516 | alc262_lenovo_3000_unsol_verbs }, |
| 10517 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10518 | .dac_nids = alc262_dac_nids, |
| 10519 | .hp_nid = 0x03, |
| 10520 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10521 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10522 | .channel_mode = alc262_modes, |
| 10523 | .input_mux = &alc262_fujitsu_capture_source, |
| 10524 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 10525 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10526 | [ALC262_NEC] = { |
| 10527 | .mixers = { alc262_nec_mixer }, |
| 10528 | .init_verbs = { alc262_nec_verbs }, |
| 10529 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10530 | .dac_nids = alc262_dac_nids, |
| 10531 | .hp_nid = 0x03, |
| 10532 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10533 | .channel_mode = alc262_modes, |
| 10534 | .input_mux = &alc262_capture_source, |
| 10535 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10536 | [ALC262_TOSHIBA_S06] = { |
| 10537 | .mixers = { alc262_toshiba_s06_mixer }, |
| 10538 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 10539 | alc262_eapd_verbs }, |
| 10540 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10541 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 10542 | .dac_nids = alc262_dac_nids, |
| 10543 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 10544 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10545 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10546 | .channel_mode = alc262_modes, |
| 10547 | .input_mux = &alc262_dmic_capture_source, |
| 10548 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 10549 | .init_hook = alc262_toshiba_s06_init_hook, |
| 10550 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10551 | [ALC262_TOSHIBA_RX1] = { |
| 10552 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 10553 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 10554 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10555 | .dac_nids = alc262_dac_nids, |
| 10556 | .hp_nid = 0x03, |
| 10557 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10558 | .channel_mode = alc262_modes, |
| 10559 | .input_mux = &alc262_capture_source, |
| 10560 | .unsol_event = alc262_hippo_unsol_event, |
| 10561 | .init_hook = alc262_hippo_automute, |
| 10562 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10563 | }; |
| 10564 | |
| 10565 | static int patch_alc262(struct hda_codec *codec) |
| 10566 | { |
| 10567 | struct alc_spec *spec; |
| 10568 | int board_config; |
| 10569 | int err; |
| 10570 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 10571 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10572 | if (spec == NULL) |
| 10573 | return -ENOMEM; |
| 10574 | |
| 10575 | codec->spec = spec; |
| 10576 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10577 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 10578 | * under-run |
| 10579 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10580 | { |
| 10581 | int tmp; |
| 10582 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10583 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 10584 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10585 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 10586 | } |
| 10587 | #endif |
| 10588 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 10589 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10590 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10591 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 10592 | alc262_models, |
| 10593 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10594 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10595 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10596 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 10597 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10598 | board_config = ALC262_AUTO; |
| 10599 | } |
| 10600 | |
| 10601 | if (board_config == ALC262_AUTO) { |
| 10602 | /* automatic parse from the BIOS config */ |
| 10603 | err = alc262_parse_auto_config(codec); |
| 10604 | if (err < 0) { |
| 10605 | alc_free(codec); |
| 10606 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10607 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10608 | printk(KERN_INFO |
| 10609 | "hda_codec: Cannot set up configuration " |
| 10610 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10611 | board_config = ALC262_BASIC; |
| 10612 | } |
| 10613 | } |
| 10614 | |
| 10615 | if (board_config != ALC262_AUTO) |
| 10616 | setup_preset(spec, &alc262_presets[board_config]); |
| 10617 | |
| 10618 | spec->stream_name_analog = "ALC262 Analog"; |
| 10619 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 10620 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10621 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10622 | spec->stream_name_digital = "ALC262 Digital"; |
| 10623 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 10624 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 10625 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10626 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10627 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 10628 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 10629 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10630 | /* get type */ |
| 10631 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10632 | if (wcap != AC_WID_AUD_IN) { |
| 10633 | spec->adc_nids = alc262_adc_nids_alt; |
| 10634 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10635 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10636 | spec->mixers[spec->num_mixers] = |
| 10637 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10638 | spec->num_mixers++; |
| 10639 | } else { |
| 10640 | spec->adc_nids = alc262_adc_nids; |
| 10641 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10642 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10643 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 10644 | spec->num_mixers++; |
| 10645 | } |
| 10646 | } |
| 10647 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10648 | spec->vmaster_nid = 0x0c; |
| 10649 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10650 | codec->patch_ops = alc_patch_ops; |
| 10651 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10652 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10653 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10654 | if (!spec->loopback.amplist) |
| 10655 | spec->loopback.amplist = alc262_loopbacks; |
| 10656 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10657 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10658 | return 0; |
| 10659 | } |
| 10660 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10661 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10662 | * ALC268 channel source setting (2 channel) |
| 10663 | */ |
| 10664 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 10665 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10666 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10667 | static hda_nid_t alc268_dac_nids[2] = { |
| 10668 | /* front, hp */ |
| 10669 | 0x02, 0x03 |
| 10670 | }; |
| 10671 | |
| 10672 | static hda_nid_t alc268_adc_nids[2] = { |
| 10673 | /* ADC0-1 */ |
| 10674 | 0x08, 0x07 |
| 10675 | }; |
| 10676 | |
| 10677 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 10678 | /* ADC0 */ |
| 10679 | 0x08 |
| 10680 | }; |
| 10681 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10682 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 10683 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10684 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 10685 | /* output mixer control */ |
| 10686 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10687 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10688 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10689 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10690 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10691 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10692 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10693 | { } |
| 10694 | }; |
| 10695 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10696 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 10697 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 10698 | .ops = &snd_hda_bind_sw, |
| 10699 | .values = { |
| 10700 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 10701 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 10702 | 0 |
| 10703 | }, |
| 10704 | }; |
| 10705 | |
| 10706 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 10707 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 10708 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 10709 | { } |
| 10710 | }; |
| 10711 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10712 | static struct hda_verb alc268_eapd_verbs[] = { |
| 10713 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10714 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10715 | { } |
| 10716 | }; |
| 10717 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10718 | /* Toshiba specific */ |
| 10719 | #define alc268_toshiba_automute alc262_hippo_automute |
| 10720 | |
| 10721 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 10722 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10723 | { } /* end */ |
| 10724 | }; |
| 10725 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10726 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 10727 | .num_items = 2, |
| 10728 | .items = { |
| 10729 | { "i-Mic", 0x6 }, |
| 10730 | { "E-Mic", 0x0 }, |
| 10731 | }, |
| 10732 | }; |
| 10733 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10734 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10735 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 10736 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 10737 | .ops = &snd_hda_bind_vol, |
| 10738 | .values = { |
| 10739 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 10740 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 10741 | 0 |
| 10742 | }, |
| 10743 | }; |
| 10744 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10745 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10746 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 10747 | { |
| 10748 | struct alc_spec *spec = codec->spec; |
| 10749 | unsigned int mute; |
| 10750 | |
| 10751 | if (force || !spec->sense_updated) { |
| 10752 | unsigned int present; |
| 10753 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10754 | AC_VERB_GET_PIN_SENSE, 0); |
| 10755 | spec->jack_present = (present & 0x80000000) != 0; |
| 10756 | spec->sense_updated = 1; |
| 10757 | } |
| 10758 | if (spec->jack_present) |
| 10759 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 10760 | else /* unmute internal speaker if necessary */ |
| 10761 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 10762 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10763 | HDA_AMP_MUTE, mute); |
| 10764 | } |
| 10765 | |
| 10766 | |
| 10767 | /* bind hp and internal speaker mute (with plug check) */ |
| 10768 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10769 | struct snd_ctl_elem_value *ucontrol) |
| 10770 | { |
| 10771 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10772 | long *valp = ucontrol->value.integer.value; |
| 10773 | int change; |
| 10774 | |
| 10775 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10776 | HDA_AMP_MUTE, |
| 10777 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 10778 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10779 | HDA_AMP_MUTE, |
| 10780 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 10781 | if (change) |
| 10782 | alc268_acer_automute(codec, 0); |
| 10783 | return change; |
| 10784 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10785 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10786 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 10787 | /* output mixer control */ |
| 10788 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10789 | { |
| 10790 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10791 | .name = "Master Playback Switch", |
| 10792 | .info = snd_hda_mixer_amp_switch_info, |
| 10793 | .get = snd_hda_mixer_amp_switch_get, |
| 10794 | .put = alc268_acer_master_sw_put, |
| 10795 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10796 | }, |
| 10797 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 10798 | { } |
| 10799 | }; |
| 10800 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10801 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 10802 | /* output mixer control */ |
| 10803 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10804 | { |
| 10805 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10806 | .name = "Master Playback Switch", |
| 10807 | .info = snd_hda_mixer_amp_switch_info, |
| 10808 | .get = snd_hda_mixer_amp_switch_get, |
| 10809 | .put = alc268_acer_master_sw_put, |
| 10810 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10811 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10812 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10813 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10814 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10815 | { } |
| 10816 | }; |
| 10817 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10818 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 10819 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10820 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10821 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10822 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10823 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 10824 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 10825 | { } |
| 10826 | }; |
| 10827 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10828 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10829 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 10830 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10831 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10832 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10833 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10834 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10835 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10836 | { } |
| 10837 | }; |
| 10838 | |
| 10839 | /* unsolicited event for HP jack sensing */ |
| 10840 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 10841 | unsigned int res) |
| 10842 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10843 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10844 | return; |
| 10845 | alc268_toshiba_automute(codec); |
| 10846 | } |
| 10847 | |
| 10848 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 10849 | unsigned int res) |
| 10850 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10851 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10852 | return; |
| 10853 | alc268_acer_automute(codec, 1); |
| 10854 | } |
| 10855 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10856 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 10857 | { |
| 10858 | alc268_acer_automute(codec, 1); |
| 10859 | } |
| 10860 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10861 | /* toggle speaker-output according to the hp-jack state */ |
| 10862 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 10863 | { |
| 10864 | unsigned int present; |
| 10865 | unsigned char bits; |
| 10866 | |
| 10867 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10868 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10869 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 10870 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 10871 | AMP_IN_MUTE(0), bits); |
| 10872 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 10873 | AMP_IN_MUTE(0), bits); |
| 10874 | } |
| 10875 | |
| 10876 | |
| 10877 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 10878 | { |
| 10879 | unsigned int present; |
| 10880 | |
| 10881 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10882 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10883 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 10884 | present ? 0x0 : 0x6); |
| 10885 | } |
| 10886 | |
| 10887 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 10888 | unsigned int res) |
| 10889 | { |
| 10890 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10891 | alc268_aspire_one_speaker_automute(codec); |
| 10892 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10893 | alc268_acer_mic_automute(codec); |
| 10894 | } |
| 10895 | |
| 10896 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 10897 | { |
| 10898 | alc268_aspire_one_speaker_automute(codec); |
| 10899 | alc268_acer_mic_automute(codec); |
| 10900 | } |
| 10901 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10902 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 10903 | /* output mixer control */ |
| 10904 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10905 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10906 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10907 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10908 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10909 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10910 | { } |
| 10911 | }; |
| 10912 | |
| 10913 | static struct hda_verb alc268_dell_verbs[] = { |
| 10914 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10915 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10916 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10917 | { } |
| 10918 | }; |
| 10919 | |
| 10920 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10921 | static void alc268_dell_automute(struct hda_codec *codec) |
| 10922 | { |
| 10923 | unsigned int present; |
| 10924 | unsigned int mute; |
| 10925 | |
| 10926 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 10927 | if (present & 0x80000000) |
| 10928 | mute = HDA_AMP_MUTE; |
| 10929 | else |
| 10930 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 10931 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10932 | HDA_AMP_MUTE, mute); |
| 10933 | } |
| 10934 | |
| 10935 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 10936 | unsigned int res) |
| 10937 | { |
| 10938 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10939 | return; |
| 10940 | alc268_dell_automute(codec); |
| 10941 | } |
| 10942 | |
| 10943 | #define alc268_dell_init_hook alc268_dell_automute |
| 10944 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10945 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 10946 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10947 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10948 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10949 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10950 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10951 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10952 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 10953 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10954 | { } |
| 10955 | }; |
| 10956 | |
| 10957 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 10958 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10959 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 10960 | { } |
| 10961 | }; |
| 10962 | |
| 10963 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 10964 | { |
| 10965 | unsigned int present; |
| 10966 | |
| 10967 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 10968 | & AC_PINSENSE_PRESENCE; |
| 10969 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10970 | present ? 0 : PIN_OUT); |
| 10971 | } |
| 10972 | |
| 10973 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 10974 | { |
| 10975 | unsigned int present; |
| 10976 | |
| 10977 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10978 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10979 | snd_hda_codec_write(codec, 0x23, 0, |
| 10980 | AC_VERB_SET_CONNECT_SEL, |
| 10981 | present ? 0x00 : 0x01); |
| 10982 | } |
| 10983 | |
| 10984 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 10985 | { |
| 10986 | alc267_quanta_il1_hp_automute(codec); |
| 10987 | alc267_quanta_il1_mic_automute(codec); |
| 10988 | } |
| 10989 | |
| 10990 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 10991 | unsigned int res) |
| 10992 | { |
| 10993 | switch (res >> 26) { |
| 10994 | case ALC880_HP_EVENT: |
| 10995 | alc267_quanta_il1_hp_automute(codec); |
| 10996 | break; |
| 10997 | case ALC880_MIC_EVENT: |
| 10998 | alc267_quanta_il1_mic_automute(codec); |
| 10999 | break; |
| 11000 | } |
| 11001 | } |
| 11002 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11003 | /* |
| 11004 | * generic initialization of ADC, input mixers and output mixers |
| 11005 | */ |
| 11006 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11007 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11008 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11009 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11010 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11011 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11012 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11013 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11014 | |
| 11015 | /* |
| 11016 | * Set up output mixers (0x0c - 0x0e) |
| 11017 | */ |
| 11018 | /* set vol=0 to output mixers */ |
| 11019 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11020 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11021 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11022 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11023 | |
| 11024 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11025 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11026 | |
| 11027 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11029 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11030 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11031 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11032 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11033 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11034 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11035 | |
| 11036 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11038 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11039 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11040 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11041 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11042 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11043 | |
| 11044 | /* set PCBEEP vol = 0, mute connections */ |
| 11045 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11046 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11047 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11048 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11049 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11050 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11051 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11052 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11053 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11054 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11055 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11056 | { } |
| 11057 | }; |
| 11058 | |
| 11059 | /* |
| 11060 | * generic initialization of ADC, input mixers and output mixers |
| 11061 | */ |
| 11062 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11063 | /* set output DAC */ |
| 11064 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11065 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11066 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11067 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11068 | |
| 11069 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11070 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11071 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11072 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11073 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11074 | |
| 11075 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11076 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11077 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11078 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11079 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11080 | |
| 11081 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11082 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11083 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11084 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11085 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11086 | /* set PCBEEP vol = 0, mute connections */ |
| 11087 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11088 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11089 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11090 | |
| 11091 | { } |
| 11092 | }; |
| 11093 | |
| 11094 | #define alc268_mux_enum_info alc_mux_enum_info |
| 11095 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11096 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11097 | |
| 11098 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11099 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11100 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11101 | { |
| 11102 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11103 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11104 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11105 | */ |
| 11106 | /* .name = "Capture Source", */ |
| 11107 | .name = "Input Source", |
| 11108 | .count = 1, |
| 11109 | .info = alc268_mux_enum_info, |
| 11110 | .get = alc268_mux_enum_get, |
| 11111 | .put = alc268_mux_enum_put, |
| 11112 | }, |
| 11113 | { } /* end */ |
| 11114 | }; |
| 11115 | |
| 11116 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11117 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11118 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11119 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11120 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11121 | { |
| 11122 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11123 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11124 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11125 | */ |
| 11126 | /* .name = "Capture Source", */ |
| 11127 | .name = "Input Source", |
| 11128 | .count = 2, |
| 11129 | .info = alc268_mux_enum_info, |
| 11130 | .get = alc268_mux_enum_get, |
| 11131 | .put = alc268_mux_enum_put, |
| 11132 | }, |
| 11133 | { } /* end */ |
| 11134 | }; |
| 11135 | |
| 11136 | static struct hda_input_mux alc268_capture_source = { |
| 11137 | .num_items = 4, |
| 11138 | .items = { |
| 11139 | { "Mic", 0x0 }, |
| 11140 | { "Front Mic", 0x1 }, |
| 11141 | { "Line", 0x2 }, |
| 11142 | { "CD", 0x3 }, |
| 11143 | }, |
| 11144 | }; |
| 11145 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11146 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11147 | .num_items = 3, |
| 11148 | .items = { |
| 11149 | { "Mic", 0x0 }, |
| 11150 | { "Internal Mic", 0x6 }, |
| 11151 | { "Line", 0x2 }, |
| 11152 | }, |
| 11153 | }; |
| 11154 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11155 | #ifdef CONFIG_SND_DEBUG |
| 11156 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11157 | /* Volume widgets */ |
| 11158 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11159 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11160 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11161 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11162 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11163 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11164 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11165 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11166 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11167 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11168 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11169 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11170 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11171 | /* The below appears problematic on some hardwares */ |
| 11172 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11173 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11174 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11175 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11176 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11177 | |
| 11178 | /* Modes for retasking pin widgets */ |
| 11179 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11180 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11181 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11182 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11183 | |
| 11184 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11185 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11186 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11187 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11188 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11189 | |
| 11190 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11191 | * The ALC268 does not have an SPDIF input. |
| 11192 | */ |
| 11193 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11194 | |
| 11195 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11196 | * this output to turn on an external amplifier. |
| 11197 | */ |
| 11198 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11199 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11200 | |
| 11201 | { } /* end */ |
| 11202 | }; |
| 11203 | #endif |
| 11204 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11205 | /* create input playback/capture controls for the given pin */ |
| 11206 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11207 | const char *ctlname, int idx) |
| 11208 | { |
| 11209 | char name[32]; |
| 11210 | int err; |
| 11211 | |
| 11212 | sprintf(name, "%s Playback Volume", ctlname); |
| 11213 | if (nid == 0x14) { |
| 11214 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11215 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11216 | HDA_OUTPUT)); |
| 11217 | if (err < 0) |
| 11218 | return err; |
| 11219 | } else if (nid == 0x15) { |
| 11220 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11221 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11222 | HDA_OUTPUT)); |
| 11223 | if (err < 0) |
| 11224 | return err; |
| 11225 | } else |
| 11226 | return -1; |
| 11227 | sprintf(name, "%s Playback Switch", ctlname); |
| 11228 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11229 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11230 | if (err < 0) |
| 11231 | return err; |
| 11232 | return 0; |
| 11233 | } |
| 11234 | |
| 11235 | /* add playback controls from the parsed DAC table */ |
| 11236 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11237 | const struct auto_pin_cfg *cfg) |
| 11238 | { |
| 11239 | hda_nid_t nid; |
| 11240 | int err; |
| 11241 | |
| 11242 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11243 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11244 | spec->multiout.dac_nids[0] = 2; |
| 11245 | spec->multiout.dac_nids[1] = 3; |
| 11246 | |
| 11247 | nid = cfg->line_out_pins[0]; |
| 11248 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11249 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11250 | |
| 11251 | nid = cfg->speaker_pins[0]; |
| 11252 | if (nid == 0x1d) { |
| 11253 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11254 | "Speaker Playback Volume", |
| 11255 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11256 | if (err < 0) |
| 11257 | return err; |
| 11258 | } |
| 11259 | nid = cfg->hp_pins[0]; |
| 11260 | if (nid) |
| 11261 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11262 | |
| 11263 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11264 | if (nid == 0x16) { |
| 11265 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11266 | "Mono Playback Switch", |
| 11267 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11268 | if (err < 0) |
| 11269 | return err; |
| 11270 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11271 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11272 | } |
| 11273 | |
| 11274 | /* create playback/capture controls for input pins */ |
| 11275 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11276 | const struct auto_pin_cfg *cfg) |
| 11277 | { |
| 11278 | struct hda_input_mux *imux = &spec->private_imux; |
| 11279 | int i, idx1; |
| 11280 | |
| 11281 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11282 | switch(cfg->input_pins[i]) { |
| 11283 | case 0x18: |
| 11284 | idx1 = 0; /* Mic 1 */ |
| 11285 | break; |
| 11286 | case 0x19: |
| 11287 | idx1 = 1; /* Mic 2 */ |
| 11288 | break; |
| 11289 | case 0x1a: |
| 11290 | idx1 = 2; /* Line In */ |
| 11291 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11292 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11293 | idx1 = 3; /* CD */ |
| 11294 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11295 | case 0x12: |
| 11296 | case 0x13: |
| 11297 | idx1 = 6; /* digital mics */ |
| 11298 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11299 | default: |
| 11300 | continue; |
| 11301 | } |
| 11302 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11303 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11304 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11305 | } |
| 11306 | return 0; |
| 11307 | } |
| 11308 | |
| 11309 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11310 | { |
| 11311 | struct alc_spec *spec = codec->spec; |
| 11312 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11313 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11314 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11315 | unsigned int dac_vol1, dac_vol2; |
| 11316 | |
| 11317 | if (speaker_nid) { |
| 11318 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11319 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11320 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11321 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11322 | AMP_IN_UNMUTE(1)); |
| 11323 | snd_hda_codec_write(codec, 0x10, 0, |
| 11324 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11325 | AMP_IN_UNMUTE(1)); |
| 11326 | } else { |
| 11327 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11328 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11329 | snd_hda_codec_write(codec, 0x10, 0, |
| 11330 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11331 | } |
| 11332 | |
| 11333 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11334 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11335 | dac_vol2 = AMP_OUT_ZERO; |
| 11336 | else if (line_nid == 0x15) |
| 11337 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11338 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11339 | dac_vol2 = AMP_OUT_ZERO; |
| 11340 | else if (hp_nid == 0x15) |
| 11341 | dac_vol1 = AMP_OUT_ZERO; |
| 11342 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11343 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11344 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11345 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11346 | |
| 11347 | snd_hda_codec_write(codec, 0x02, 0, |
| 11348 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11349 | snd_hda_codec_write(codec, 0x03, 0, |
| 11350 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11351 | } |
| 11352 | |
| 11353 | /* pcm configuration: identiacal with ALC880 */ |
| 11354 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11355 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11356 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11357 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11358 | |
| 11359 | /* |
| 11360 | * BIOS auto configuration |
| 11361 | */ |
| 11362 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11363 | { |
| 11364 | struct alc_spec *spec = codec->spec; |
| 11365 | int err; |
| 11366 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11367 | |
| 11368 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11369 | alc268_ignore); |
| 11370 | if (err < 0) |
| 11371 | return err; |
| 11372 | if (!spec->autocfg.line_outs) |
| 11373 | return 0; /* can't find valid BIOS pin config */ |
| 11374 | |
| 11375 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11376 | if (err < 0) |
| 11377 | return err; |
| 11378 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11379 | if (err < 0) |
| 11380 | return err; |
| 11381 | |
| 11382 | spec->multiout.max_channels = 2; |
| 11383 | |
| 11384 | /* digital only support output */ |
| 11385 | if (spec->autocfg.dig_out_pin) |
| 11386 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 11387 | |
| 11388 | if (spec->kctl_alloc) |
| 11389 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11390 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11391 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 11392 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 11393 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11394 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 11395 | spec->num_mux_defs = 1; |
| 11396 | spec->input_mux = &spec->private_imux; |
| 11397 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11398 | err = alc_auto_add_mic_boost(codec); |
| 11399 | if (err < 0) |
| 11400 | return err; |
| 11401 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11402 | return 1; |
| 11403 | } |
| 11404 | |
| 11405 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11406 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11407 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11408 | |
| 11409 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11410 | static void alc268_auto_init(struct hda_codec *codec) |
| 11411 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11412 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11413 | alc268_auto_init_multi_out(codec); |
| 11414 | alc268_auto_init_hp_out(codec); |
| 11415 | alc268_auto_init_mono_speaker_out(codec); |
| 11416 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11417 | if (spec->unsol_event) |
| 11418 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11419 | } |
| 11420 | |
| 11421 | /* |
| 11422 | * configuration and preset |
| 11423 | */ |
| 11424 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11425 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11426 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11427 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11428 | [ALC268_ACER] = "acer", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11429 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11430 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11431 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11432 | #ifdef CONFIG_SND_DEBUG |
| 11433 | [ALC268_TEST] = "test", |
| 11434 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11435 | [ALC268_AUTO] = "auto", |
| 11436 | }; |
| 11437 | |
| 11438 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 11439 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11440 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11441 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11442 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11443 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11444 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 11445 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11446 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11447 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11448 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11449 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11450 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 11451 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11452 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11453 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11454 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11455 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11456 | {} |
| 11457 | }; |
| 11458 | |
| 11459 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11460 | [ALC267_QUANTA_IL1] = { |
| 11461 | .mixers = { alc267_quanta_il1_mixer }, |
| 11462 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11463 | alc267_quanta_il1_verbs }, |
| 11464 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11465 | .dac_nids = alc268_dac_nids, |
| 11466 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11467 | .adc_nids = alc268_adc_nids_alt, |
| 11468 | .hp_nid = 0x03, |
| 11469 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11470 | .channel_mode = alc268_modes, |
| 11471 | .input_mux = &alc268_capture_source, |
| 11472 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 11473 | .init_hook = alc267_quanta_il1_automute, |
| 11474 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11475 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11476 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11477 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11478 | .init_verbs = { alc268_base_init_verbs }, |
| 11479 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11480 | .dac_nids = alc268_dac_nids, |
| 11481 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11482 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11483 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11484 | .hp_nid = 0x03, |
| 11485 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11486 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11487 | .channel_mode = alc268_modes, |
| 11488 | .input_mux = &alc268_capture_source, |
| 11489 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11490 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11491 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11492 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11493 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11494 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11495 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11496 | .dac_nids = alc268_dac_nids, |
| 11497 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11498 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11499 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11500 | .hp_nid = 0x03, |
| 11501 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11502 | .channel_mode = alc268_modes, |
| 11503 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11504 | .unsol_event = alc268_toshiba_unsol_event, |
| 11505 | .init_hook = alc268_toshiba_automute, |
| 11506 | }, |
| 11507 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11508 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 11509 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11510 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11511 | alc268_acer_verbs }, |
| 11512 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11513 | .dac_nids = alc268_dac_nids, |
| 11514 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11515 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11516 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11517 | .hp_nid = 0x02, |
| 11518 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11519 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11520 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11521 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11522 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11523 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11524 | [ALC268_ACER_ASPIRE_ONE] = { |
| 11525 | .mixers = { alc268_acer_aspire_one_mixer, |
| 11526 | alc268_capture_alt_mixer }, |
| 11527 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11528 | alc268_acer_aspire_one_verbs }, |
| 11529 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11530 | .dac_nids = alc268_dac_nids, |
| 11531 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11532 | .adc_nids = alc268_adc_nids_alt, |
| 11533 | .capsrc_nids = alc268_capsrc_nids, |
| 11534 | .hp_nid = 0x03, |
| 11535 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11536 | .channel_mode = alc268_modes, |
| 11537 | .input_mux = &alc268_acer_lc_capture_source, |
| 11538 | .unsol_event = alc268_acer_lc_unsol_event, |
| 11539 | .init_hook = alc268_acer_lc_init_hook, |
| 11540 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11541 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11542 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11543 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11544 | alc268_dell_verbs }, |
| 11545 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11546 | .dac_nids = alc268_dac_nids, |
| 11547 | .hp_nid = 0x02, |
| 11548 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11549 | .channel_mode = alc268_modes, |
| 11550 | .unsol_event = alc268_dell_unsol_event, |
| 11551 | .init_hook = alc268_dell_init_hook, |
| 11552 | .input_mux = &alc268_capture_source, |
| 11553 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11554 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11555 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11556 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11557 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11558 | alc268_toshiba_verbs }, |
| 11559 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11560 | .dac_nids = alc268_dac_nids, |
| 11561 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11562 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11563 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11564 | .hp_nid = 0x03, |
| 11565 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11566 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11567 | .channel_mode = alc268_modes, |
| 11568 | .input_mux = &alc268_capture_source, |
| 11569 | .unsol_event = alc268_toshiba_unsol_event, |
| 11570 | .init_hook = alc268_toshiba_automute |
| 11571 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11572 | #ifdef CONFIG_SND_DEBUG |
| 11573 | [ALC268_TEST] = { |
| 11574 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 11575 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11576 | alc268_volume_init_verbs }, |
| 11577 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11578 | .dac_nids = alc268_dac_nids, |
| 11579 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11580 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11581 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11582 | .hp_nid = 0x03, |
| 11583 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11584 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11585 | .channel_mode = alc268_modes, |
| 11586 | .input_mux = &alc268_capture_source, |
| 11587 | }, |
| 11588 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11589 | }; |
| 11590 | |
| 11591 | static int patch_alc268(struct hda_codec *codec) |
| 11592 | { |
| 11593 | struct alc_spec *spec; |
| 11594 | int board_config; |
| 11595 | int err; |
| 11596 | |
| 11597 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 11598 | if (spec == NULL) |
| 11599 | return -ENOMEM; |
| 11600 | |
| 11601 | codec->spec = spec; |
| 11602 | |
| 11603 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 11604 | alc268_models, |
| 11605 | alc268_cfg_tbl); |
| 11606 | |
| 11607 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 11608 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 11609 | "trying auto-probe from BIOS...\n"); |
| 11610 | board_config = ALC268_AUTO; |
| 11611 | } |
| 11612 | |
| 11613 | if (board_config == ALC268_AUTO) { |
| 11614 | /* automatic parse from the BIOS config */ |
| 11615 | err = alc268_parse_auto_config(codec); |
| 11616 | if (err < 0) { |
| 11617 | alc_free(codec); |
| 11618 | return err; |
| 11619 | } else if (!err) { |
| 11620 | printk(KERN_INFO |
| 11621 | "hda_codec: Cannot set up configuration " |
| 11622 | "from BIOS. Using base mode...\n"); |
| 11623 | board_config = ALC268_3ST; |
| 11624 | } |
| 11625 | } |
| 11626 | |
| 11627 | if (board_config != ALC268_AUTO) |
| 11628 | setup_preset(spec, &alc268_presets[board_config]); |
| 11629 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11630 | if (codec->vendor_id == 0x10ec0267) { |
| 11631 | spec->stream_name_analog = "ALC267 Analog"; |
| 11632 | spec->stream_name_digital = "ALC267 Digital"; |
| 11633 | } else { |
| 11634 | spec->stream_name_analog = "ALC268 Analog"; |
| 11635 | spec->stream_name_digital = "ALC268 Digital"; |
| 11636 | } |
| 11637 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11638 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 11639 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11640 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11641 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11642 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 11643 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11644 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 11645 | /* override the amp caps for beep generator */ |
| 11646 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 11647 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 11648 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 11649 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 11650 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 11651 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11652 | if (!spec->adc_nids && spec->input_mux) { |
| 11653 | /* check whether NID 0x07 is valid */ |
| 11654 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11655 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11656 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11657 | /* get type */ |
| 11658 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 11659 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11660 | spec->adc_nids = alc268_adc_nids_alt; |
| 11661 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 11662 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11663 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11664 | spec->num_mixers++; |
| 11665 | } else { |
| 11666 | spec->adc_nids = alc268_adc_nids; |
| 11667 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 11668 | spec->mixers[spec->num_mixers] = |
| 11669 | alc268_capture_mixer; |
| 11670 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11671 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11672 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11673 | /* set default input source */ |
| 11674 | for (i = 0; i < spec->num_adc_nids; i++) |
| 11675 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 11676 | 0, AC_VERB_SET_CONNECT_SEL, |
| 11677 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11678 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11679 | |
| 11680 | spec->vmaster_nid = 0x02; |
| 11681 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11682 | codec->patch_ops = alc_patch_ops; |
| 11683 | if (board_config == ALC268_AUTO) |
| 11684 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11685 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11686 | return 0; |
| 11687 | } |
| 11688 | |
| 11689 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11690 | * ALC269 channel source setting (2 channel) |
| 11691 | */ |
| 11692 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 11693 | |
| 11694 | #define alc269_dac_nids alc260_dac_nids |
| 11695 | |
| 11696 | static hda_nid_t alc269_adc_nids[1] = { |
| 11697 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11698 | 0x08, |
| 11699 | }; |
| 11700 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 11701 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 11702 | 0x23, |
| 11703 | }; |
| 11704 | |
| 11705 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 11706 | * not a mux! |
| 11707 | */ |
| 11708 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11709 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 11710 | .num_items = 2, |
| 11711 | .items = { |
| 11712 | { "i-Mic", 0x5 }, |
| 11713 | { "e-Mic", 0x0 }, |
| 11714 | }, |
| 11715 | }; |
| 11716 | |
| 11717 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 11718 | .num_items = 2, |
| 11719 | .items = { |
| 11720 | { "i-Mic", 0x1 }, |
| 11721 | { "e-Mic", 0x0 }, |
| 11722 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11723 | }; |
| 11724 | |
| 11725 | #define alc269_modes alc260_modes |
| 11726 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 11727 | |
| 11728 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 11729 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11730 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11731 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11732 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11733 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11734 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11735 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11736 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11737 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11738 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11739 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11740 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11741 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11742 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 11743 | { } /* end */ |
| 11744 | }; |
| 11745 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11746 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 11747 | /* output mixer control */ |
| 11748 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11749 | { |
| 11750 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11751 | .name = "Master Playback Switch", |
| 11752 | .info = snd_hda_mixer_amp_switch_info, |
| 11753 | .get = snd_hda_mixer_amp_switch_get, |
| 11754 | .put = alc268_acer_master_sw_put, |
| 11755 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11756 | }, |
| 11757 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11758 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11759 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11760 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11761 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11762 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11763 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11764 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11765 | { } |
| 11766 | }; |
| 11767 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11768 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 11769 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 11770 | .ops = &snd_hda_bind_vol, |
| 11771 | .values = { |
| 11772 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11773 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11774 | 0 |
| 11775 | }, |
| 11776 | }; |
| 11777 | |
| 11778 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 11779 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11780 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 11781 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11782 | { } /* end */ |
| 11783 | }; |
| 11784 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11785 | /* capture mixer elements */ |
| 11786 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11787 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11788 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11789 | { |
| 11790 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11791 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11792 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11793 | */ |
| 11794 | /* .name = "Capture Source", */ |
| 11795 | .name = "Input Source", |
| 11796 | .count = 1, |
| 11797 | .info = alc_mux_enum_info, |
| 11798 | .get = alc_mux_enum_get, |
| 11799 | .put = alc_mux_enum_put, |
| 11800 | }, |
| 11801 | { } /* end */ |
| 11802 | }; |
| 11803 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11804 | /* capture mixer elements */ |
| 11805 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 11806 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11807 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11808 | { } /* end */ |
| 11809 | }; |
| 11810 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11811 | /* beep control */ |
| 11812 | static struct snd_kcontrol_new alc269_beep_mixer[] = { |
| 11813 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11814 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
| 11815 | { } /* end */ |
| 11816 | }; |
| 11817 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11818 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 11819 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11820 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11821 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11822 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11823 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11824 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11825 | { } |
| 11826 | }; |
| 11827 | |
| 11828 | /* toggle speaker-output according to the hp-jack state */ |
| 11829 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 11830 | { |
| 11831 | unsigned int present; |
| 11832 | unsigned char bits; |
| 11833 | |
| 11834 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11835 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11836 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11837 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11838 | AMP_IN_MUTE(0), bits); |
| 11839 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11840 | AMP_IN_MUTE(0), bits); |
| 11841 | |
| 11842 | snd_hda_codec_write(codec, 0x20, 0, |
| 11843 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11844 | snd_hda_codec_write(codec, 0x20, 0, |
| 11845 | AC_VERB_SET_PROC_COEF, 0x680); |
| 11846 | |
| 11847 | snd_hda_codec_write(codec, 0x20, 0, |
| 11848 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11849 | snd_hda_codec_write(codec, 0x20, 0, |
| 11850 | AC_VERB_SET_PROC_COEF, 0x480); |
| 11851 | } |
| 11852 | |
| 11853 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 11854 | { |
| 11855 | unsigned int present; |
| 11856 | |
| 11857 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11858 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11859 | snd_hda_codec_write(codec, 0x23, 0, |
| 11860 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 11861 | } |
| 11862 | |
| 11863 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 11864 | unsigned int res) |
| 11865 | { |
| 11866 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11867 | alc269_quanta_fl1_speaker_automute(codec); |
| 11868 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11869 | alc269_quanta_fl1_mic_automute(codec); |
| 11870 | } |
| 11871 | |
| 11872 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 11873 | { |
| 11874 | alc269_quanta_fl1_speaker_automute(codec); |
| 11875 | alc269_quanta_fl1_mic_automute(codec); |
| 11876 | } |
| 11877 | |
| 11878 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 11879 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11880 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 11881 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11882 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 11883 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11884 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11885 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11886 | {} |
| 11887 | }; |
| 11888 | |
| 11889 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 11890 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11891 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11892 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11893 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 11894 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11895 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11896 | {} |
| 11897 | }; |
| 11898 | |
| 11899 | /* toggle speaker-output according to the hp-jack state */ |
| 11900 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 11901 | { |
| 11902 | unsigned int present; |
| 11903 | unsigned char bits; |
| 11904 | |
| 11905 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11906 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11907 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11908 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11909 | AMP_IN_MUTE(0), bits); |
| 11910 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11911 | AMP_IN_MUTE(0), bits); |
| 11912 | } |
| 11913 | |
| 11914 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 11915 | { |
| 11916 | unsigned int present; |
| 11917 | |
| 11918 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11919 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11920 | snd_hda_codec_write(codec, 0x23, 0, |
| 11921 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 11922 | } |
| 11923 | |
| 11924 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 11925 | { |
| 11926 | unsigned int present; |
| 11927 | |
| 11928 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11929 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11930 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11931 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 11932 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11933 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 11934 | } |
| 11935 | |
| 11936 | /* unsolicited event for HP jack sensing */ |
| 11937 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 11938 | unsigned int res) |
| 11939 | { |
| 11940 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11941 | alc269_speaker_automute(codec); |
| 11942 | |
| 11943 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11944 | alc269_eeepc_dmic_automute(codec); |
| 11945 | } |
| 11946 | |
| 11947 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 11948 | { |
| 11949 | alc269_speaker_automute(codec); |
| 11950 | alc269_eeepc_dmic_automute(codec); |
| 11951 | } |
| 11952 | |
| 11953 | /* unsolicited event for HP jack sensing */ |
| 11954 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 11955 | unsigned int res) |
| 11956 | { |
| 11957 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11958 | alc269_speaker_automute(codec); |
| 11959 | |
| 11960 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11961 | alc269_eeepc_amic_automute(codec); |
| 11962 | } |
| 11963 | |
| 11964 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 11965 | { |
| 11966 | alc269_speaker_automute(codec); |
| 11967 | alc269_eeepc_amic_automute(codec); |
| 11968 | } |
| 11969 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11970 | /* |
| 11971 | * generic initialization of ADC, input mixers and output mixers |
| 11972 | */ |
| 11973 | static struct hda_verb alc269_init_verbs[] = { |
| 11974 | /* |
| 11975 | * Unmute ADC0 and set the default input to mic-in |
| 11976 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11977 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11978 | |
| 11979 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 11980 | * analog-loopback mixer widget |
| 11981 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11982 | * front panel mic (mic 2) |
| 11983 | */ |
| 11984 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 11985 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11986 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11987 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11988 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11989 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11990 | |
| 11991 | /* |
| 11992 | * Set up output mixers (0x0c - 0x0e) |
| 11993 | */ |
| 11994 | /* set vol=0 to output mixers */ |
| 11995 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11996 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11997 | |
| 11998 | /* set up input amps for analog loopback */ |
| 11999 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12000 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12001 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12002 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12003 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12004 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12005 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12006 | |
| 12007 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12008 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12009 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12010 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12011 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12012 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12013 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12014 | |
| 12015 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12016 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12017 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12018 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12019 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12020 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12021 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12022 | |
| 12023 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12024 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12025 | |
| 12026 | /* FIXME: use matrix-type input source selection */ |
| 12027 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12028 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12029 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12030 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12031 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12032 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12033 | |
| 12034 | /* set EAPD */ |
| 12035 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12036 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12037 | { } |
| 12038 | }; |
| 12039 | |
| 12040 | /* add playback controls from the parsed DAC table */ |
| 12041 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12042 | const struct auto_pin_cfg *cfg) |
| 12043 | { |
| 12044 | hda_nid_t nid; |
| 12045 | int err; |
| 12046 | |
| 12047 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12048 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12049 | spec->multiout.dac_nids[0] = 2; |
| 12050 | |
| 12051 | nid = cfg->line_out_pins[0]; |
| 12052 | if (nid) { |
| 12053 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12054 | "Front Playback Volume", |
| 12055 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12056 | if (err < 0) |
| 12057 | return err; |
| 12058 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12059 | "Front Playback Switch", |
| 12060 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12061 | if (err < 0) |
| 12062 | return err; |
| 12063 | } |
| 12064 | |
| 12065 | nid = cfg->speaker_pins[0]; |
| 12066 | if (nid) { |
| 12067 | if (!cfg->line_out_pins[0]) { |
| 12068 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12069 | "Speaker Playback Volume", |
| 12070 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12071 | HDA_OUTPUT)); |
| 12072 | if (err < 0) |
| 12073 | return err; |
| 12074 | } |
| 12075 | if (nid == 0x16) { |
| 12076 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12077 | "Speaker Playback Switch", |
| 12078 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12079 | HDA_OUTPUT)); |
| 12080 | if (err < 0) |
| 12081 | return err; |
| 12082 | } else { |
| 12083 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12084 | "Speaker Playback Switch", |
| 12085 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12086 | HDA_OUTPUT)); |
| 12087 | if (err < 0) |
| 12088 | return err; |
| 12089 | } |
| 12090 | } |
| 12091 | nid = cfg->hp_pins[0]; |
| 12092 | if (nid) { |
| 12093 | /* spec->multiout.hp_nid = 2; */ |
| 12094 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12095 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12096 | "Headphone Playback Volume", |
| 12097 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12098 | HDA_OUTPUT)); |
| 12099 | if (err < 0) |
| 12100 | return err; |
| 12101 | } |
| 12102 | if (nid == 0x16) { |
| 12103 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12104 | "Headphone Playback Switch", |
| 12105 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12106 | HDA_OUTPUT)); |
| 12107 | if (err < 0) |
| 12108 | return err; |
| 12109 | } else { |
| 12110 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12111 | "Headphone Playback Switch", |
| 12112 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12113 | HDA_OUTPUT)); |
| 12114 | if (err < 0) |
| 12115 | return err; |
| 12116 | } |
| 12117 | } |
| 12118 | return 0; |
| 12119 | } |
| 12120 | |
| 12121 | #define alc269_auto_create_analog_input_ctls \ |
| 12122 | alc880_auto_create_analog_input_ctls |
| 12123 | |
| 12124 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12125 | #define alc269_loopbacks alc880_loopbacks |
| 12126 | #endif |
| 12127 | |
| 12128 | /* pcm configuration: identiacal with ALC880 */ |
| 12129 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12130 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12131 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12132 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12133 | |
| 12134 | /* |
| 12135 | * BIOS auto configuration |
| 12136 | */ |
| 12137 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12138 | { |
| 12139 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12140 | int i, err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12141 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12142 | |
| 12143 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12144 | alc269_ignore); |
| 12145 | if (err < 0) |
| 12146 | return err; |
| 12147 | |
| 12148 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12149 | if (err < 0) |
| 12150 | return err; |
| 12151 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12152 | if (err < 0) |
| 12153 | return err; |
| 12154 | |
| 12155 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12156 | |
| 12157 | if (spec->autocfg.dig_out_pin) |
| 12158 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12159 | |
| 12160 | if (spec->kctl_alloc) |
| 12161 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12162 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12163 | /* create a beep mixer control if the pin 0x1d isn't assigned */ |
| 12164 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) |
| 12165 | if (spec->autocfg.input_pins[i] == 0x1d) |
| 12166 | break; |
| 12167 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) |
| 12168 | spec->mixers[spec->num_mixers++] = alc269_beep_mixer; |
| 12169 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12170 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 12171 | spec->num_mux_defs = 1; |
| 12172 | spec->input_mux = &spec->private_imux; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12173 | /* set default input source */ |
| 12174 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12175 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12176 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12177 | |
| 12178 | err = alc_auto_add_mic_boost(codec); |
| 12179 | if (err < 0) |
| 12180 | return err; |
| 12181 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12182 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 12183 | spec->num_mixers++; |
| 12184 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12185 | return 1; |
| 12186 | } |
| 12187 | |
| 12188 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12189 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12190 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12191 | |
| 12192 | |
| 12193 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12194 | static void alc269_auto_init(struct hda_codec *codec) |
| 12195 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12196 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12197 | alc269_auto_init_multi_out(codec); |
| 12198 | alc269_auto_init_hp_out(codec); |
| 12199 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12200 | if (spec->unsol_event) |
| 12201 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12202 | } |
| 12203 | |
| 12204 | /* |
| 12205 | * configuration and preset |
| 12206 | */ |
| 12207 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12208 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12209 | [ALC269_QUANTA_FL1] = "quanta", |
| 12210 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
| 12211 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12212 | }; |
| 12213 | |
| 12214 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12215 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12216 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12217 | ALC269_ASUS_EEEPC_P703), |
| 12218 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12219 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12220 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12221 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12222 | {} |
| 12223 | }; |
| 12224 | |
| 12225 | static struct alc_config_preset alc269_presets[] = { |
| 12226 | [ALC269_BASIC] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12227 | .mixers = { alc269_base_mixer, alc269_capture_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12228 | .init_verbs = { alc269_init_verbs }, |
| 12229 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12230 | .dac_nids = alc269_dac_nids, |
| 12231 | .hp_nid = 0x03, |
| 12232 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12233 | .channel_mode = alc269_modes, |
| 12234 | .input_mux = &alc269_capture_source, |
| 12235 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12236 | [ALC269_QUANTA_FL1] = { |
| 12237 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12238 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12239 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12240 | .dac_nids = alc269_dac_nids, |
| 12241 | .hp_nid = 0x03, |
| 12242 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12243 | .channel_mode = alc269_modes, |
| 12244 | .input_mux = &alc269_capture_source, |
| 12245 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12246 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12247 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12248 | [ALC269_ASUS_EEEPC_P703] = { |
| 12249 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, |
| 12250 | .init_verbs = { alc269_init_verbs, |
| 12251 | alc269_eeepc_amic_init_verbs }, |
| 12252 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12253 | .dac_nids = alc269_dac_nids, |
| 12254 | .hp_nid = 0x03, |
| 12255 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12256 | .channel_mode = alc269_modes, |
| 12257 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12258 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12259 | .init_hook = alc269_eeepc_amic_inithook, |
| 12260 | }, |
| 12261 | [ALC269_ASUS_EEEPC_P901] = { |
| 12262 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer}, |
| 12263 | .init_verbs = { alc269_init_verbs, |
| 12264 | alc269_eeepc_dmic_init_verbs }, |
| 12265 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12266 | .dac_nids = alc269_dac_nids, |
| 12267 | .hp_nid = 0x03, |
| 12268 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12269 | .channel_mode = alc269_modes, |
| 12270 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12271 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12272 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12273 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12274 | }; |
| 12275 | |
| 12276 | static int patch_alc269(struct hda_codec *codec) |
| 12277 | { |
| 12278 | struct alc_spec *spec; |
| 12279 | int board_config; |
| 12280 | int err; |
| 12281 | |
| 12282 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12283 | if (spec == NULL) |
| 12284 | return -ENOMEM; |
| 12285 | |
| 12286 | codec->spec = spec; |
| 12287 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12288 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 12289 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12290 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 12291 | alc269_models, |
| 12292 | alc269_cfg_tbl); |
| 12293 | |
| 12294 | if (board_config < 0) { |
| 12295 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 12296 | "trying auto-probe from BIOS...\n"); |
| 12297 | board_config = ALC269_AUTO; |
| 12298 | } |
| 12299 | |
| 12300 | if (board_config == ALC269_AUTO) { |
| 12301 | /* automatic parse from the BIOS config */ |
| 12302 | err = alc269_parse_auto_config(codec); |
| 12303 | if (err < 0) { |
| 12304 | alc_free(codec); |
| 12305 | return err; |
| 12306 | } else if (!err) { |
| 12307 | printk(KERN_INFO |
| 12308 | "hda_codec: Cannot set up configuration " |
| 12309 | "from BIOS. Using base mode...\n"); |
| 12310 | board_config = ALC269_BASIC; |
| 12311 | } |
| 12312 | } |
| 12313 | |
| 12314 | if (board_config != ALC269_AUTO) |
| 12315 | setup_preset(spec, &alc269_presets[board_config]); |
| 12316 | |
| 12317 | spec->stream_name_analog = "ALC269 Analog"; |
| 12318 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 12319 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 12320 | |
| 12321 | spec->stream_name_digital = "ALC269 Digital"; |
| 12322 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 12323 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 12324 | |
| 12325 | spec->adc_nids = alc269_adc_nids; |
| 12326 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12327 | spec->capsrc_nids = alc269_capsrc_nids; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12328 | |
| 12329 | codec->patch_ops = alc_patch_ops; |
| 12330 | if (board_config == ALC269_AUTO) |
| 12331 | spec->init_hook = alc269_auto_init; |
| 12332 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12333 | if (!spec->loopback.amplist) |
| 12334 | spec->loopback.amplist = alc269_loopbacks; |
| 12335 | #endif |
| 12336 | |
| 12337 | return 0; |
| 12338 | } |
| 12339 | |
| 12340 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12341 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 12342 | */ |
| 12343 | |
| 12344 | /* |
| 12345 | * set the path ways for 2 channel output |
| 12346 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 12347 | */ |
| 12348 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 12349 | /* set pin widget 1Ah (line in) for input */ |
| 12350 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12351 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12352 | * the vref |
| 12353 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12354 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12355 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12356 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12357 | #if 0 |
| 12358 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12359 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12360 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12361 | { } /* end */ |
| 12362 | }; |
| 12363 | /* |
| 12364 | * 6ch mode |
| 12365 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 12366 | */ |
| 12367 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 12368 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12369 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12370 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12371 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12372 | |
| 12373 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12374 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12375 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12376 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12377 | #if 0 |
| 12378 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12379 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12380 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12381 | { } /* end */ |
| 12382 | }; |
| 12383 | |
| 12384 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 12385 | { 2, alc861_threestack_ch2_init }, |
| 12386 | { 6, alc861_threestack_ch6_init }, |
| 12387 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12388 | /* Set mic1 as input and unmute the mixer */ |
| 12389 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 12390 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12391 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12392 | { } /* end */ |
| 12393 | }; |
| 12394 | /* Set mic1 as output and mute mixer */ |
| 12395 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 12396 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12397 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12398 | { } /* end */ |
| 12399 | }; |
| 12400 | |
| 12401 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 12402 | { 2, alc861_uniwill_m31_ch2_init }, |
| 12403 | { 4, alc861_uniwill_m31_ch4_init }, |
| 12404 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12405 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12406 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 12407 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 12408 | /* set pin widget 1Ah (line in) for input */ |
| 12409 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12410 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12411 | * the vref |
| 12412 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12413 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12414 | |
| 12415 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12416 | #if 0 |
| 12417 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12418 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12419 | #endif |
| 12420 | { } /* end */ |
| 12421 | }; |
| 12422 | /* Set mic1 nad line-in as output and mute mixer */ |
| 12423 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 12424 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12425 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12426 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12427 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12428 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12429 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12430 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12431 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12432 | |
| 12433 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12434 | #if 0 |
| 12435 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12436 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12437 | #endif |
| 12438 | { } /* end */ |
| 12439 | }; |
| 12440 | |
| 12441 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 12442 | { 2, alc861_asus_ch2_init }, |
| 12443 | { 6, alc861_asus_ch6_init }, |
| 12444 | }; |
| 12445 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12446 | /* patch-ALC861 */ |
| 12447 | |
| 12448 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 12449 | /* output mixer control */ |
| 12450 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12451 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12452 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12453 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12454 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12455 | |
| 12456 | /*Input mixer control */ |
| 12457 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12458 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12459 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12460 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12461 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12462 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12463 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12464 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12465 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12466 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12467 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12468 | /* Capture mixer control */ |
| 12469 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12470 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12471 | { |
| 12472 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12473 | .name = "Capture Source", |
| 12474 | .count = 1, |
| 12475 | .info = alc_mux_enum_info, |
| 12476 | .get = alc_mux_enum_get, |
| 12477 | .put = alc_mux_enum_put, |
| 12478 | }, |
| 12479 | { } /* end */ |
| 12480 | }; |
| 12481 | |
| 12482 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 12483 | /* output mixer control */ |
| 12484 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12485 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12486 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12487 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12488 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12489 | |
| 12490 | /* Input mixer control */ |
| 12491 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12492 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12493 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12494 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12495 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12496 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12497 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12498 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12499 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12500 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12501 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12502 | /* Capture mixer control */ |
| 12503 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12504 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12505 | { |
| 12506 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12507 | .name = "Capture Source", |
| 12508 | .count = 1, |
| 12509 | .info = alc_mux_enum_info, |
| 12510 | .get = alc_mux_enum_get, |
| 12511 | .put = alc_mux_enum_put, |
| 12512 | }, |
| 12513 | { |
| 12514 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12515 | .name = "Channel Mode", |
| 12516 | .info = alc_ch_mode_info, |
| 12517 | .get = alc_ch_mode_get, |
| 12518 | .put = alc_ch_mode_put, |
| 12519 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 12520 | }, |
| 12521 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12522 | }; |
| 12523 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12524 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12525 | /* output mixer control */ |
| 12526 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12527 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12528 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12529 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12530 | /*Capture mixer control */ |
| 12531 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12532 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12533 | { |
| 12534 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12535 | .name = "Capture Source", |
| 12536 | .count = 1, |
| 12537 | .info = alc_mux_enum_info, |
| 12538 | .get = alc_mux_enum_get, |
| 12539 | .put = alc_mux_enum_put, |
| 12540 | }, |
| 12541 | |
| 12542 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12543 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12544 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12545 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 12546 | /* output mixer control */ |
| 12547 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12548 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12549 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12550 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12551 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12552 | |
| 12553 | /* Input mixer control */ |
| 12554 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12555 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12556 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12557 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12558 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12559 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12560 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12561 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12562 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12563 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12564 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12565 | /* Capture mixer control */ |
| 12566 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12567 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12568 | { |
| 12569 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12570 | .name = "Capture Source", |
| 12571 | .count = 1, |
| 12572 | .info = alc_mux_enum_info, |
| 12573 | .get = alc_mux_enum_get, |
| 12574 | .put = alc_mux_enum_put, |
| 12575 | }, |
| 12576 | { |
| 12577 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12578 | .name = "Channel Mode", |
| 12579 | .info = alc_ch_mode_info, |
| 12580 | .get = alc_ch_mode_get, |
| 12581 | .put = alc_ch_mode_put, |
| 12582 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12583 | }, |
| 12584 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12585 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12586 | |
| 12587 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 12588 | /* output mixer control */ |
| 12589 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12590 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12591 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12592 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12593 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12594 | |
| 12595 | /* Input mixer control */ |
| 12596 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12597 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12598 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12599 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12600 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12601 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12602 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12603 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12604 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12605 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 12606 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12607 | /* Capture mixer control */ |
| 12608 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12609 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12610 | { |
| 12611 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12612 | .name = "Capture Source", |
| 12613 | .count = 1, |
| 12614 | .info = alc_mux_enum_info, |
| 12615 | .get = alc_mux_enum_get, |
| 12616 | .put = alc_mux_enum_put, |
| 12617 | }, |
| 12618 | { |
| 12619 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12620 | .name = "Channel Mode", |
| 12621 | .info = alc_ch_mode_info, |
| 12622 | .get = alc_ch_mode_get, |
| 12623 | .put = alc_ch_mode_put, |
| 12624 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 12625 | }, |
| 12626 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12627 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12628 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12629 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12630 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12631 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12632 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12633 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12634 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12635 | { } |
| 12636 | }; |
| 12637 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12638 | /* |
| 12639 | * generic initialization of ADC, input mixers and output mixers |
| 12640 | */ |
| 12641 | static struct hda_verb alc861_base_init_verbs[] = { |
| 12642 | /* |
| 12643 | * Unmute ADC0 and set the default input to mic-in |
| 12644 | */ |
| 12645 | /* port-A for surround (rear panel) */ |
| 12646 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12647 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12648 | /* port-B for mic-in (rear panel) with vref */ |
| 12649 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12650 | /* port-C for line-in (rear panel) */ |
| 12651 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12652 | /* port-D for Front */ |
| 12653 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12654 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12655 | /* port-E for HP out (front panel) */ |
| 12656 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12657 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12658 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12659 | /* port-F for mic-in (front panel) with vref */ |
| 12660 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12661 | /* port-G for CLFE (rear panel) */ |
| 12662 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12663 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12664 | /* port-H for side (rear panel) */ |
| 12665 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12666 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12667 | /* CD-in */ |
| 12668 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12669 | /* route front mic to ADC1*/ |
| 12670 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12671 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12672 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12673 | /* Unmute DAC0~3 & spdif out*/ |
| 12674 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12675 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12676 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12677 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12678 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12679 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12680 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12681 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12682 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12683 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12684 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12685 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12686 | /* Unmute Stereo Mixer 15 */ |
| 12687 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12688 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12689 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12690 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12691 | |
| 12692 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12693 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12694 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12695 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12696 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12697 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12698 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12699 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12700 | /* hp used DAC 3 (Front) */ |
| 12701 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12702 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12703 | |
| 12704 | { } |
| 12705 | }; |
| 12706 | |
| 12707 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 12708 | /* |
| 12709 | * Unmute ADC0 and set the default input to mic-in |
| 12710 | */ |
| 12711 | /* port-A for surround (rear panel) */ |
| 12712 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12713 | /* port-B for mic-in (rear panel) with vref */ |
| 12714 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12715 | /* port-C for line-in (rear panel) */ |
| 12716 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12717 | /* port-D for Front */ |
| 12718 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12719 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12720 | /* port-E for HP out (front panel) */ |
| 12721 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12722 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12723 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12724 | /* port-F for mic-in (front panel) with vref */ |
| 12725 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12726 | /* port-G for CLFE (rear panel) */ |
| 12727 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12728 | /* port-H for side (rear panel) */ |
| 12729 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12730 | /* CD-in */ |
| 12731 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12732 | /* route front mic to ADC1*/ |
| 12733 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12734 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12735 | /* Unmute DAC0~3 & spdif out*/ |
| 12736 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12737 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12738 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12739 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12740 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12741 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12742 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12743 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12744 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12745 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12746 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12747 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12748 | /* Unmute Stereo Mixer 15 */ |
| 12749 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12750 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12751 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12752 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12753 | |
| 12754 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12755 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12756 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12757 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12758 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12759 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12760 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12761 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12762 | /* hp used DAC 3 (Front) */ |
| 12763 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12764 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12765 | { } |
| 12766 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12767 | |
| 12768 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 12769 | /* |
| 12770 | * Unmute ADC0 and set the default input to mic-in |
| 12771 | */ |
| 12772 | /* port-A for surround (rear panel) */ |
| 12773 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12774 | /* port-B for mic-in (rear panel) with vref */ |
| 12775 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12776 | /* port-C for line-in (rear panel) */ |
| 12777 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12778 | /* port-D for Front */ |
| 12779 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12780 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12781 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12782 | /* this has to be set to VREF80 */ |
| 12783 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12784 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12785 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12786 | /* port-F for mic-in (front panel) with vref */ |
| 12787 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12788 | /* port-G for CLFE (rear panel) */ |
| 12789 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12790 | /* port-H for side (rear panel) */ |
| 12791 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12792 | /* CD-in */ |
| 12793 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12794 | /* route front mic to ADC1*/ |
| 12795 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12796 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12797 | /* Unmute DAC0~3 & spdif out*/ |
| 12798 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12799 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12800 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12801 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12802 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12803 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12804 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12805 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12806 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12807 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12808 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12809 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12810 | /* Unmute Stereo Mixer 15 */ |
| 12811 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12812 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12813 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12814 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12815 | |
| 12816 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12817 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12818 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12819 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12820 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12821 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12822 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12823 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12824 | /* hp used DAC 3 (Front) */ |
| 12825 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12826 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12827 | { } |
| 12828 | }; |
| 12829 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12830 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 12831 | /* |
| 12832 | * Unmute ADC0 and set the default input to mic-in |
| 12833 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12834 | /* port-A for surround (rear panel) |
| 12835 | * according to codec#0 this is the HP jack |
| 12836 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12837 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 12838 | /* route front PCM to HP */ |
| 12839 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12840 | /* port-B for mic-in (rear panel) with vref */ |
| 12841 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12842 | /* port-C for line-in (rear panel) */ |
| 12843 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12844 | /* port-D for Front */ |
| 12845 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12846 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12847 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12848 | /* this has to be set to VREF80 */ |
| 12849 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12850 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12851 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12852 | /* port-F for mic-in (front panel) with vref */ |
| 12853 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12854 | /* port-G for CLFE (rear panel) */ |
| 12855 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12856 | /* port-H for side (rear panel) */ |
| 12857 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12858 | /* CD-in */ |
| 12859 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12860 | /* route front mic to ADC1*/ |
| 12861 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12862 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12863 | /* Unmute DAC0~3 & spdif out*/ |
| 12864 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12865 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12866 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12867 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12868 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12869 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12870 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12871 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12872 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12873 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12874 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12875 | /* Unmute Stereo Mixer 15 */ |
| 12876 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12877 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12878 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12879 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12880 | |
| 12881 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12882 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12883 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12884 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12885 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12886 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12887 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12888 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12889 | /* hp used DAC 3 (Front) */ |
| 12890 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12891 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12892 | { } |
| 12893 | }; |
| 12894 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12895 | /* additional init verbs for ASUS laptops */ |
| 12896 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 12897 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 12898 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 12899 | { } |
| 12900 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12901 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12902 | /* |
| 12903 | * generic initialization of ADC, input mixers and output mixers |
| 12904 | */ |
| 12905 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 12906 | /* |
| 12907 | * Unmute ADC0 and set the default input to mic-in |
| 12908 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12909 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12910 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12911 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12912 | /* Unmute DAC0~3 & spdif out*/ |
| 12913 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12914 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12915 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12916 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12917 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12918 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12919 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12920 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12921 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12922 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12923 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12924 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12925 | /* Unmute Stereo Mixer 15 */ |
| 12926 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12927 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12929 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 12930 | |
| 12931 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12932 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12933 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12934 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12935 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12936 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12937 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12938 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12939 | |
| 12940 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12941 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12942 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12943 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12944 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12945 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12946 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12947 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12948 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12949 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12950 | |
| 12951 | { } |
| 12952 | }; |
| 12953 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12954 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 12955 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12956 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12957 | { } |
| 12958 | }; |
| 12959 | |
| 12960 | /* toggle speaker-output according to the hp-jack state */ |
| 12961 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 12962 | { |
| 12963 | unsigned int present; |
| 12964 | |
| 12965 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 12966 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12967 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 12968 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 12969 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 12970 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12971 | } |
| 12972 | |
| 12973 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 12974 | unsigned int res) |
| 12975 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12976 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12977 | alc861_toshiba_automute(codec); |
| 12978 | } |
| 12979 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12980 | /* pcm configuration: identiacal with ALC880 */ |
| 12981 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 12982 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 12983 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 12984 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 12985 | |
| 12986 | |
| 12987 | #define ALC861_DIGOUT_NID 0x07 |
| 12988 | |
| 12989 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 12990 | { 8, NULL } |
| 12991 | }; |
| 12992 | |
| 12993 | static hda_nid_t alc861_dac_nids[4] = { |
| 12994 | /* front, surround, clfe, side */ |
| 12995 | 0x03, 0x06, 0x05, 0x04 |
| 12996 | }; |
| 12997 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12998 | static hda_nid_t alc660_dac_nids[3] = { |
| 12999 | /* front, clfe, surround */ |
| 13000 | 0x03, 0x05, 0x06 |
| 13001 | }; |
| 13002 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13003 | static hda_nid_t alc861_adc_nids[1] = { |
| 13004 | /* ADC0-2 */ |
| 13005 | 0x08, |
| 13006 | }; |
| 13007 | |
| 13008 | static struct hda_input_mux alc861_capture_source = { |
| 13009 | .num_items = 5, |
| 13010 | .items = { |
| 13011 | { "Mic", 0x0 }, |
| 13012 | { "Front Mic", 0x3 }, |
| 13013 | { "Line", 0x1 }, |
| 13014 | { "CD", 0x4 }, |
| 13015 | { "Mixer", 0x5 }, |
| 13016 | }, |
| 13017 | }; |
| 13018 | |
| 13019 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13020 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13021 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13022 | { |
| 13023 | int i; |
| 13024 | hda_nid_t nid; |
| 13025 | |
| 13026 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13027 | for (i = 0; i < cfg->line_outs; i++) { |
| 13028 | nid = cfg->line_out_pins[i]; |
| 13029 | if (nid) { |
| 13030 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13031 | continue; |
| 13032 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13033 | } |
| 13034 | } |
| 13035 | spec->multiout.num_dacs = cfg->line_outs; |
| 13036 | return 0; |
| 13037 | } |
| 13038 | |
| 13039 | /* add playback controls from the parsed DAC table */ |
| 13040 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13041 | const struct auto_pin_cfg *cfg) |
| 13042 | { |
| 13043 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13044 | static const char *chname[4] = { |
| 13045 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13046 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13047 | hda_nid_t nid; |
| 13048 | int i, idx, err; |
| 13049 | |
| 13050 | for (i = 0; i < cfg->line_outs; i++) { |
| 13051 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13052 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13053 | continue; |
| 13054 | if (nid == 0x05) { |
| 13055 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13056 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13057 | "Center Playback Switch", |
| 13058 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13059 | HDA_OUTPUT)); |
| 13060 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13061 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13062 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13063 | "LFE Playback Switch", |
| 13064 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13065 | HDA_OUTPUT)); |
| 13066 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13067 | return err; |
| 13068 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13069 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13070 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13071 | if (nid == alc861_dac_nids[idx]) |
| 13072 | break; |
| 13073 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13074 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13075 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13076 | HDA_OUTPUT)); |
| 13077 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13078 | return err; |
| 13079 | } |
| 13080 | } |
| 13081 | return 0; |
| 13082 | } |
| 13083 | |
| 13084 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13085 | { |
| 13086 | int err; |
| 13087 | hda_nid_t nid; |
| 13088 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13089 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13090 | return 0; |
| 13091 | |
| 13092 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13093 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13094 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13095 | "Headphone Playback Switch", |
| 13096 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13097 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13098 | return err; |
| 13099 | spec->multiout.hp_nid = nid; |
| 13100 | } |
| 13101 | return 0; |
| 13102 | } |
| 13103 | |
| 13104 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13105 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13106 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13107 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13108 | struct hda_input_mux *imux = &spec->private_imux; |
| 13109 | int i, err, idx, idx1; |
| 13110 | |
| 13111 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13112 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13113 | case 0x0c: |
| 13114 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13115 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13116 | break; |
| 13117 | case 0x0f: |
| 13118 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13119 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13120 | break; |
| 13121 | case 0x0d: |
| 13122 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13123 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13124 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13125 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13126 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13127 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13128 | break; |
| 13129 | case 0x11: |
| 13130 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13131 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13132 | break; |
| 13133 | default: |
| 13134 | continue; |
| 13135 | } |
| 13136 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13137 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13138 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13139 | if (err < 0) |
| 13140 | return err; |
| 13141 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13142 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13143 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13144 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13145 | } |
| 13146 | return 0; |
| 13147 | } |
| 13148 | |
| 13149 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 13150 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13151 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13152 | |
| 13153 | { |
| 13154 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13155 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13156 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13157 | */ |
| 13158 | /* .name = "Capture Source", */ |
| 13159 | .name = "Input Source", |
| 13160 | .count = 1, |
| 13161 | .info = alc_mux_enum_info, |
| 13162 | .get = alc_mux_enum_get, |
| 13163 | .put = alc_mux_enum_put, |
| 13164 | }, |
| 13165 | { } /* end */ |
| 13166 | }; |
| 13167 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13168 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13169 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13170 | int pin_type, int dac_idx) |
| 13171 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13172 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13173 | pin_type); |
| 13174 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13175 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13176 | } |
| 13177 | |
| 13178 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13179 | { |
| 13180 | struct alc_spec *spec = codec->spec; |
| 13181 | int i; |
| 13182 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13183 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13184 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13185 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13186 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13187 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13188 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13189 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13190 | } |
| 13191 | } |
| 13192 | |
| 13193 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13194 | { |
| 13195 | struct alc_spec *spec = codec->spec; |
| 13196 | hda_nid_t pin; |
| 13197 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13198 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13199 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13200 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13201 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13202 | pin = spec->autocfg.speaker_pins[0]; |
| 13203 | if (pin) |
| 13204 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13205 | } |
| 13206 | |
| 13207 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13208 | { |
| 13209 | struct alc_spec *spec = codec->spec; |
| 13210 | int i; |
| 13211 | |
| 13212 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13213 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13214 | if (nid >= 0x0c && nid <= 0x11) { |
| 13215 | snd_hda_codec_write(codec, nid, 0, |
| 13216 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13217 | i <= AUTO_PIN_FRONT_MIC ? |
| 13218 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13219 | } |
| 13220 | } |
| 13221 | } |
| 13222 | |
| 13223 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13224 | /* return 1 if successful, 0 if the proper config is not found, |
| 13225 | * or a negative error code |
| 13226 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13227 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13228 | { |
| 13229 | struct alc_spec *spec = codec->spec; |
| 13230 | int err; |
| 13231 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13232 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13233 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13234 | alc861_ignore); |
| 13235 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13236 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13237 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13238 | return 0; /* can't find valid BIOS pin config */ |
| 13239 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13240 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13241 | if (err < 0) |
| 13242 | return err; |
| 13243 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13244 | if (err < 0) |
| 13245 | return err; |
| 13246 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13247 | if (err < 0) |
| 13248 | return err; |
| 13249 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13250 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13251 | return err; |
| 13252 | |
| 13253 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13254 | |
| 13255 | if (spec->autocfg.dig_out_pin) |
| 13256 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13257 | |
| 13258 | if (spec->kctl_alloc) |
| 13259 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13260 | |
| 13261 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 13262 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13263 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13264 | spec->input_mux = &spec->private_imux; |
| 13265 | |
| 13266 | spec->adc_nids = alc861_adc_nids; |
| 13267 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 13268 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 13269 | spec->num_mixers++; |
| 13270 | |
| 13271 | return 1; |
| 13272 | } |
| 13273 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13274 | /* additional initialization for auto-configuration model */ |
| 13275 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13276 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13277 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13278 | alc861_auto_init_multi_out(codec); |
| 13279 | alc861_auto_init_hp_out(codec); |
| 13280 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13281 | if (spec->unsol_event) |
| 13282 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13283 | } |
| 13284 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13285 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13286 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13287 | { 0x15, HDA_INPUT, 0 }, |
| 13288 | { 0x15, HDA_INPUT, 1 }, |
| 13289 | { 0x15, HDA_INPUT, 2 }, |
| 13290 | { 0x15, HDA_INPUT, 3 }, |
| 13291 | { } /* end */ |
| 13292 | }; |
| 13293 | #endif |
| 13294 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13295 | |
| 13296 | /* |
| 13297 | * configuration and preset |
| 13298 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13299 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13300 | [ALC861_3ST] = "3stack", |
| 13301 | [ALC660_3ST] = "3stack-660", |
| 13302 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13303 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13304 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 13305 | [ALC861_TOSHIBA] = "toshiba", |
| 13306 | [ALC861_ASUS] = "asus", |
| 13307 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 13308 | [ALC861_AUTO] = "auto", |
| 13309 | }; |
| 13310 | |
| 13311 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 13312 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13313 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13314 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13315 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13316 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 13317 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 13318 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 13319 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 13320 | * Any other models that need this preset? |
| 13321 | */ |
| 13322 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 13323 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 13324 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13325 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 13326 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 13327 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 13328 | /* FIXME: the below seems conflict */ |
| 13329 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 13330 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 13331 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13332 | {} |
| 13333 | }; |
| 13334 | |
| 13335 | static struct alc_config_preset alc861_presets[] = { |
| 13336 | [ALC861_3ST] = { |
| 13337 | .mixers = { alc861_3ST_mixer }, |
| 13338 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13339 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13340 | .dac_nids = alc861_dac_nids, |
| 13341 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13342 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13343 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13344 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13345 | .adc_nids = alc861_adc_nids, |
| 13346 | .input_mux = &alc861_capture_source, |
| 13347 | }, |
| 13348 | [ALC861_3ST_DIG] = { |
| 13349 | .mixers = { alc861_base_mixer }, |
| 13350 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13351 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13352 | .dac_nids = alc861_dac_nids, |
| 13353 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13354 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13355 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13356 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13357 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13358 | .adc_nids = alc861_adc_nids, |
| 13359 | .input_mux = &alc861_capture_source, |
| 13360 | }, |
| 13361 | [ALC861_6ST_DIG] = { |
| 13362 | .mixers = { alc861_base_mixer }, |
| 13363 | .init_verbs = { alc861_base_init_verbs }, |
| 13364 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13365 | .dac_nids = alc861_dac_nids, |
| 13366 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13367 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 13368 | .channel_mode = alc861_8ch_modes, |
| 13369 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13370 | .adc_nids = alc861_adc_nids, |
| 13371 | .input_mux = &alc861_capture_source, |
| 13372 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13373 | [ALC660_3ST] = { |
| 13374 | .mixers = { alc861_3ST_mixer }, |
| 13375 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13376 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 13377 | .dac_nids = alc660_dac_nids, |
| 13378 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13379 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13380 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13381 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13382 | .adc_nids = alc861_adc_nids, |
| 13383 | .input_mux = &alc861_capture_source, |
| 13384 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13385 | [ALC861_UNIWILL_M31] = { |
| 13386 | .mixers = { alc861_uniwill_m31_mixer }, |
| 13387 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 13388 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13389 | .dac_nids = alc861_dac_nids, |
| 13390 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13391 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13392 | .channel_mode = alc861_uniwill_m31_modes, |
| 13393 | .need_dac_fix = 1, |
| 13394 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13395 | .adc_nids = alc861_adc_nids, |
| 13396 | .input_mux = &alc861_capture_source, |
| 13397 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13398 | [ALC861_TOSHIBA] = { |
| 13399 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13400 | .init_verbs = { alc861_base_init_verbs, |
| 13401 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13402 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13403 | .dac_nids = alc861_dac_nids, |
| 13404 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13405 | .channel_mode = alc883_3ST_2ch_modes, |
| 13406 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13407 | .adc_nids = alc861_adc_nids, |
| 13408 | .input_mux = &alc861_capture_source, |
| 13409 | .unsol_event = alc861_toshiba_unsol_event, |
| 13410 | .init_hook = alc861_toshiba_automute, |
| 13411 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13412 | [ALC861_ASUS] = { |
| 13413 | .mixers = { alc861_asus_mixer }, |
| 13414 | .init_verbs = { alc861_asus_init_verbs }, |
| 13415 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13416 | .dac_nids = alc861_dac_nids, |
| 13417 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13418 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 13419 | .channel_mode = alc861_asus_modes, |
| 13420 | .need_dac_fix = 1, |
| 13421 | .hp_nid = 0x06, |
| 13422 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13423 | .adc_nids = alc861_adc_nids, |
| 13424 | .input_mux = &alc861_capture_source, |
| 13425 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13426 | [ALC861_ASUS_LAPTOP] = { |
| 13427 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 13428 | .init_verbs = { alc861_asus_init_verbs, |
| 13429 | alc861_asus_laptop_init_verbs }, |
| 13430 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13431 | .dac_nids = alc861_dac_nids, |
| 13432 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13433 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13434 | .channel_mode = alc883_3ST_2ch_modes, |
| 13435 | .need_dac_fix = 1, |
| 13436 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13437 | .adc_nids = alc861_adc_nids, |
| 13438 | .input_mux = &alc861_capture_source, |
| 13439 | }, |
| 13440 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13441 | |
| 13442 | |
| 13443 | static int patch_alc861(struct hda_codec *codec) |
| 13444 | { |
| 13445 | struct alc_spec *spec; |
| 13446 | int board_config; |
| 13447 | int err; |
| 13448 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 13449 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13450 | if (spec == NULL) |
| 13451 | return -ENOMEM; |
| 13452 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13453 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13454 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13455 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 13456 | alc861_models, |
| 13457 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13458 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13459 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13460 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 13461 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13462 | board_config = ALC861_AUTO; |
| 13463 | } |
| 13464 | |
| 13465 | if (board_config == ALC861_AUTO) { |
| 13466 | /* automatic parse from the BIOS config */ |
| 13467 | err = alc861_parse_auto_config(codec); |
| 13468 | if (err < 0) { |
| 13469 | alc_free(codec); |
| 13470 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13471 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13472 | printk(KERN_INFO |
| 13473 | "hda_codec: Cannot set up configuration " |
| 13474 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13475 | board_config = ALC861_3ST_DIG; |
| 13476 | } |
| 13477 | } |
| 13478 | |
| 13479 | if (board_config != ALC861_AUTO) |
| 13480 | setup_preset(spec, &alc861_presets[board_config]); |
| 13481 | |
| 13482 | spec->stream_name_analog = "ALC861 Analog"; |
| 13483 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 13484 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 13485 | |
| 13486 | spec->stream_name_digital = "ALC861 Digital"; |
| 13487 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 13488 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 13489 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13490 | spec->vmaster_nid = 0x03; |
| 13491 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13492 | codec->patch_ops = alc_patch_ops; |
| 13493 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13494 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13495 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13496 | if (!spec->loopback.amplist) |
| 13497 | spec->loopback.amplist = alc861_loopbacks; |
| 13498 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13500 | return 0; |
| 13501 | } |
| 13502 | |
| 13503 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13504 | * ALC861-VD support |
| 13505 | * |
| 13506 | * Based on ALC882 |
| 13507 | * |
| 13508 | * In addition, an independent DAC |
| 13509 | */ |
| 13510 | #define ALC861VD_DIGOUT_NID 0x06 |
| 13511 | |
| 13512 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 13513 | /* front, surr, clfe, side surr */ |
| 13514 | 0x02, 0x03, 0x04, 0x05 |
| 13515 | }; |
| 13516 | |
| 13517 | /* dac_nids for ALC660vd are in a different order - according to |
| 13518 | * Realtek's driver. |
| 13519 | * This should probably tesult in a different mixer for 6stack models |
| 13520 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 13521 | * - and it is the same as in 861vd. |
| 13522 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 13523 | */ |
| 13524 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 13525 | /* front, rear, clfe, rear_surr */ |
| 13526 | 0x02, 0x04, 0x03 |
| 13527 | }; |
| 13528 | |
| 13529 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 13530 | /* ADC0 */ |
| 13531 | 0x09, |
| 13532 | }; |
| 13533 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13534 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 13535 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13536 | /* input MUX */ |
| 13537 | /* FIXME: should be a matrix-type input source selection */ |
| 13538 | static struct hda_input_mux alc861vd_capture_source = { |
| 13539 | .num_items = 4, |
| 13540 | .items = { |
| 13541 | { "Mic", 0x0 }, |
| 13542 | { "Front Mic", 0x1 }, |
| 13543 | { "Line", 0x2 }, |
| 13544 | { "CD", 0x4 }, |
| 13545 | }, |
| 13546 | }; |
| 13547 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13548 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13549 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13550 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13551 | { "Ext Mic", 0x0 }, |
| 13552 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13553 | }, |
| 13554 | }; |
| 13555 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13556 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 13557 | .num_items = 2, |
| 13558 | .items = { |
| 13559 | { "Front Mic", 0x0 }, |
| 13560 | { "ATAPI Mic", 0x1 }, |
| 13561 | }, |
| 13562 | }; |
| 13563 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13564 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 13565 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13566 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 13567 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13568 | |
| 13569 | /* |
| 13570 | * 2ch mode |
| 13571 | */ |
| 13572 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 13573 | { 2, NULL } |
| 13574 | }; |
| 13575 | |
| 13576 | /* |
| 13577 | * 6ch mode |
| 13578 | */ |
| 13579 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 13580 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13581 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13582 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13583 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13584 | { } /* end */ |
| 13585 | }; |
| 13586 | |
| 13587 | /* |
| 13588 | * 8ch mode |
| 13589 | */ |
| 13590 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 13591 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13592 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13593 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13594 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13595 | { } /* end */ |
| 13596 | }; |
| 13597 | |
| 13598 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 13599 | { 6, alc861vd_6stack_ch6_init }, |
| 13600 | { 8, alc861vd_6stack_ch8_init }, |
| 13601 | }; |
| 13602 | |
| 13603 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 13604 | { |
| 13605 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13606 | .name = "Channel Mode", |
| 13607 | .info = alc_ch_mode_info, |
| 13608 | .get = alc_ch_mode_get, |
| 13609 | .put = alc_ch_mode_put, |
| 13610 | }, |
| 13611 | { } /* end */ |
| 13612 | }; |
| 13613 | |
| 13614 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 13615 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13616 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13617 | |
| 13618 | { |
| 13619 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13620 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13621 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13622 | */ |
| 13623 | /* .name = "Capture Source", */ |
| 13624 | .name = "Input Source", |
| 13625 | .count = 1, |
| 13626 | .info = alc861vd_mux_enum_info, |
| 13627 | .get = alc861vd_mux_enum_get, |
| 13628 | .put = alc861vd_mux_enum_put, |
| 13629 | }, |
| 13630 | { } /* end */ |
| 13631 | }; |
| 13632 | |
| 13633 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13634 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13635 | */ |
| 13636 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 13637 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13638 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13639 | |
| 13640 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13641 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13642 | |
| 13643 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 13644 | HDA_OUTPUT), |
| 13645 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 13646 | HDA_OUTPUT), |
| 13647 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13648 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 13649 | |
| 13650 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 13651 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13652 | |
| 13653 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13654 | |
| 13655 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13656 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13657 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13658 | |
| 13659 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13660 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13661 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13662 | |
| 13663 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13664 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13665 | |
| 13666 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13667 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13668 | |
| 13669 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13670 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13671 | |
| 13672 | { } /* end */ |
| 13673 | }; |
| 13674 | |
| 13675 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 13676 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13677 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13678 | |
| 13679 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13680 | |
| 13681 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13682 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13683 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13684 | |
| 13685 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13686 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13687 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13688 | |
| 13689 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13690 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13691 | |
| 13692 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13693 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13694 | |
| 13695 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13696 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13697 | |
| 13698 | { } /* end */ |
| 13699 | }; |
| 13700 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13701 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 13702 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13703 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 13704 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13705 | |
| 13706 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13707 | |
| 13708 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13709 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13710 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13711 | |
| 13712 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13713 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13714 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13715 | |
| 13716 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13717 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13718 | |
| 13719 | { } /* end */ |
| 13720 | }; |
| 13721 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13722 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 13723 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13724 | */ |
| 13725 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13726 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13727 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13728 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13729 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13730 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13731 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13732 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13733 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13734 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13735 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13736 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 13737 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13738 | { } /* end */ |
| 13739 | }; |
| 13740 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13741 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 13742 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 13743 | */ |
| 13744 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 13745 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13746 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13747 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13748 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13749 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13750 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13751 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13752 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13753 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13754 | { } /* end */ |
| 13755 | }; |
| 13756 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13757 | /* |
| 13758 | * generic initialization of ADC, input mixers and output mixers |
| 13759 | */ |
| 13760 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 13761 | /* |
| 13762 | * Unmute ADC0 and set the default input to mic-in |
| 13763 | */ |
| 13764 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13765 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13766 | |
| 13767 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 13768 | * the analog-loopback mixer widget |
| 13769 | */ |
| 13770 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13771 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13772 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13773 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13774 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13775 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13776 | |
| 13777 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13778 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13779 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13780 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13781 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13782 | |
| 13783 | /* |
| 13784 | * Set up output mixers (0x02 - 0x05) |
| 13785 | */ |
| 13786 | /* set vol=0 to output mixers */ |
| 13787 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13788 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13789 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13790 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13791 | |
| 13792 | /* set up input amps for analog loopback */ |
| 13793 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13794 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13795 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13796 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13797 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13798 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13799 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13800 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13801 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13802 | |
| 13803 | { } |
| 13804 | }; |
| 13805 | |
| 13806 | /* |
| 13807 | * 3-stack pin configuration: |
| 13808 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 13809 | */ |
| 13810 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 13811 | /* |
| 13812 | * Set pin mode and muting |
| 13813 | */ |
| 13814 | /* set front pin widgets 0x14 for output */ |
| 13815 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13816 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13817 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13818 | |
| 13819 | /* Mic (rear) pin: input vref at 80% */ |
| 13820 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13821 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13822 | /* Front Mic pin: input vref at 80% */ |
| 13823 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13824 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13825 | /* Line In pin: input */ |
| 13826 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13827 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13828 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13829 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13830 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13831 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13832 | /* CD pin widget for input */ |
| 13833 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13834 | |
| 13835 | { } |
| 13836 | }; |
| 13837 | |
| 13838 | /* |
| 13839 | * 6-stack pin configuration: |
| 13840 | */ |
| 13841 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 13842 | /* |
| 13843 | * Set pin mode and muting |
| 13844 | */ |
| 13845 | /* set front pin widgets 0x14 for output */ |
| 13846 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13847 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13848 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13849 | |
| 13850 | /* Rear Pin: output 1 (0x0d) */ |
| 13851 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13852 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13853 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13854 | /* CLFE Pin: output 2 (0x0e) */ |
| 13855 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13856 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13857 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 13858 | /* Side Pin: output 3 (0x0f) */ |
| 13859 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13860 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13861 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 13862 | |
| 13863 | /* Mic (rear) pin: input vref at 80% */ |
| 13864 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13865 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13866 | /* Front Mic pin: input vref at 80% */ |
| 13867 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13868 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13869 | /* Line In pin: input */ |
| 13870 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13871 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13872 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13873 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13874 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13875 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13876 | /* CD pin widget for input */ |
| 13877 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13878 | |
| 13879 | { } |
| 13880 | }; |
| 13881 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13882 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 13883 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13884 | { } |
| 13885 | }; |
| 13886 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 13887 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 13888 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13889 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13890 | { } |
| 13891 | }; |
| 13892 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13893 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 13894 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13895 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13896 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 13897 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13898 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13899 | {} |
| 13900 | }; |
| 13901 | |
| 13902 | /* toggle speaker-output according to the hp-jack state */ |
| 13903 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 13904 | { |
| 13905 | unsigned int present; |
| 13906 | unsigned char bits; |
| 13907 | |
| 13908 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13909 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13910 | bits = present ? HDA_AMP_MUTE : 0; |
| 13911 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13912 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13913 | } |
| 13914 | |
| 13915 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 13916 | { |
| 13917 | unsigned int present; |
| 13918 | unsigned char bits; |
| 13919 | |
| 13920 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13921 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13922 | bits = present ? HDA_AMP_MUTE : 0; |
| 13923 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 13924 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13925 | } |
| 13926 | |
| 13927 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 13928 | { |
| 13929 | alc861vd_lenovo_hp_automute(codec); |
| 13930 | alc861vd_lenovo_mic_automute(codec); |
| 13931 | } |
| 13932 | |
| 13933 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 13934 | unsigned int res) |
| 13935 | { |
| 13936 | switch (res >> 26) { |
| 13937 | case ALC880_HP_EVENT: |
| 13938 | alc861vd_lenovo_hp_automute(codec); |
| 13939 | break; |
| 13940 | case ALC880_MIC_EVENT: |
| 13941 | alc861vd_lenovo_mic_automute(codec); |
| 13942 | break; |
| 13943 | } |
| 13944 | } |
| 13945 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13946 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 13947 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13948 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13949 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13950 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13951 | |
| 13952 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13953 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13954 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13955 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13956 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13957 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13958 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13959 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13960 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13961 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13962 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13963 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13964 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13965 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13966 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13967 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13968 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13969 | |
| 13970 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13971 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13972 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13973 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13974 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13975 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13976 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13977 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13978 | |
| 13979 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13980 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13981 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13982 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13983 | |
| 13984 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13985 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13986 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13987 | |
| 13988 | { } /* end */ |
| 13989 | }; |
| 13990 | |
| 13991 | /* toggle speaker-output according to the hp-jack state */ |
| 13992 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 13993 | { |
| 13994 | unsigned int present; |
| 13995 | |
| 13996 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13997 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13998 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13999 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14000 | } |
| 14001 | |
| 14002 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 14003 | { |
| 14004 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14005 | alc861vd_dallas_automute(codec); |
| 14006 | } |
| 14007 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14008 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14009 | #define alc861vd_loopbacks alc880_loopbacks |
| 14010 | #endif |
| 14011 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14012 | /* pcm configuration: identiacal with ALC880 */ |
| 14013 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14014 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14015 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14016 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14017 | |
| 14018 | /* |
| 14019 | * configuration and preset |
| 14020 | */ |
| 14021 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14022 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14023 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14024 | [ALC861VD_3ST] = "3stack", |
| 14025 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14026 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14027 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14028 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14029 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14030 | [ALC861VD_AUTO] = "auto", |
| 14031 | }; |
| 14032 | |
| 14033 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14034 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14035 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14036 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14037 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Alexander Holler | 2522d73 | 2008-07-17 23:36:15 +0200 | [diff] [blame] | 14038 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14039 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14040 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14041 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14042 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14043 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14044 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14045 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14046 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14047 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 14048 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Takashi Iwai | be321a89 | 2008-07-07 16:04:04 +0200 | [diff] [blame] | 14049 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14050 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14051 | {} |
| 14052 | }; |
| 14053 | |
| 14054 | static struct alc_config_preset alc861vd_presets[] = { |
| 14055 | [ALC660VD_3ST] = { |
| 14056 | .mixers = { alc861vd_3st_mixer }, |
| 14057 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14058 | alc861vd_3stack_init_verbs }, |
| 14059 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14060 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14061 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14062 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14063 | .input_mux = &alc861vd_capture_source, |
| 14064 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14065 | [ALC660VD_3ST_DIG] = { |
| 14066 | .mixers = { alc861vd_3st_mixer }, |
| 14067 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14068 | alc861vd_3stack_init_verbs }, |
| 14069 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14070 | .dac_nids = alc660vd_dac_nids, |
| 14071 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14072 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14073 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14074 | .input_mux = &alc861vd_capture_source, |
| 14075 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14076 | [ALC861VD_3ST] = { |
| 14077 | .mixers = { alc861vd_3st_mixer }, |
| 14078 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14079 | alc861vd_3stack_init_verbs }, |
| 14080 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14081 | .dac_nids = alc861vd_dac_nids, |
| 14082 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14083 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14084 | .input_mux = &alc861vd_capture_source, |
| 14085 | }, |
| 14086 | [ALC861VD_3ST_DIG] = { |
| 14087 | .mixers = { alc861vd_3st_mixer }, |
| 14088 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14089 | alc861vd_3stack_init_verbs }, |
| 14090 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14091 | .dac_nids = alc861vd_dac_nids, |
| 14092 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14093 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14094 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14095 | .input_mux = &alc861vd_capture_source, |
| 14096 | }, |
| 14097 | [ALC861VD_6ST_DIG] = { |
| 14098 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14099 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14100 | alc861vd_6stack_init_verbs }, |
| 14101 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14102 | .dac_nids = alc861vd_dac_nids, |
| 14103 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14104 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14105 | .channel_mode = alc861vd_6stack_modes, |
| 14106 | .input_mux = &alc861vd_capture_source, |
| 14107 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14108 | [ALC861VD_LENOVO] = { |
| 14109 | .mixers = { alc861vd_lenovo_mixer }, |
| 14110 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14111 | alc861vd_3stack_init_verbs, |
| 14112 | alc861vd_eapd_verbs, |
| 14113 | alc861vd_lenovo_unsol_verbs }, |
| 14114 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14115 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14116 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14117 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14118 | .input_mux = &alc861vd_capture_source, |
| 14119 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14120 | .init_hook = alc861vd_lenovo_automute, |
| 14121 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14122 | [ALC861VD_DALLAS] = { |
| 14123 | .mixers = { alc861vd_dallas_mixer }, |
| 14124 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14125 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14126 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14127 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14128 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14129 | .input_mux = &alc861vd_dallas_capture_source, |
| 14130 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14131 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14132 | }, |
| 14133 | [ALC861VD_HP] = { |
| 14134 | .mixers = { alc861vd_hp_mixer }, |
| 14135 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14136 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14137 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14138 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14139 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14140 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14141 | .input_mux = &alc861vd_hp_capture_source, |
| 14142 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14143 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14144 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14145 | }; |
| 14146 | |
| 14147 | /* |
| 14148 | * BIOS auto configuration |
| 14149 | */ |
| 14150 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14151 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14152 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14153 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14154 | } |
| 14155 | |
| 14156 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14157 | { |
| 14158 | struct alc_spec *spec = codec->spec; |
| 14159 | int i; |
| 14160 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14161 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14162 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14163 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14164 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14165 | if (nid) |
| 14166 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14167 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14168 | } |
| 14169 | } |
| 14170 | |
| 14171 | |
| 14172 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14173 | { |
| 14174 | struct alc_spec *spec = codec->spec; |
| 14175 | hda_nid_t pin; |
| 14176 | |
| 14177 | pin = spec->autocfg.hp_pins[0]; |
| 14178 | if (pin) /* connect to front and use dac 0 */ |
| 14179 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14180 | pin = spec->autocfg.speaker_pins[0]; |
| 14181 | if (pin) |
| 14182 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14183 | } |
| 14184 | |
| 14185 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14186 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14187 | |
| 14188 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14189 | { |
| 14190 | struct alc_spec *spec = codec->spec; |
| 14191 | int i; |
| 14192 | |
| 14193 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14194 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14195 | if (alc861vd_is_input_pin(nid)) { |
| 14196 | snd_hda_codec_write(codec, nid, 0, |
| 14197 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14198 | i <= AUTO_PIN_FRONT_MIC ? |
| 14199 | PIN_VREF80 : PIN_IN); |
| 14200 | if (nid != ALC861VD_PIN_CD_NID) |
| 14201 | snd_hda_codec_write(codec, nid, 0, |
| 14202 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14203 | AMP_OUT_MUTE); |
| 14204 | } |
| 14205 | } |
| 14206 | } |
| 14207 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14208 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14209 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14210 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14211 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14212 | |
| 14213 | /* add playback controls from the parsed DAC table */ |
| 14214 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14215 | * different NIDs for mute/unmute switch and volume control */ |
| 14216 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14217 | const struct auto_pin_cfg *cfg) |
| 14218 | { |
| 14219 | char name[32]; |
| 14220 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14221 | hda_nid_t nid_v, nid_s; |
| 14222 | int i, err; |
| 14223 | |
| 14224 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14225 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14226 | continue; |
| 14227 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14228 | alc880_dac_to_idx( |
| 14229 | spec->multiout.dac_nids[i])); |
| 14230 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14231 | alc880_dac_to_idx( |
| 14232 | spec->multiout.dac_nids[i])); |
| 14233 | |
| 14234 | if (i == 2) { |
| 14235 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14236 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14237 | "Center Playback Volume", |
| 14238 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14239 | HDA_OUTPUT)); |
| 14240 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14241 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14242 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14243 | "LFE Playback Volume", |
| 14244 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14245 | HDA_OUTPUT)); |
| 14246 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14247 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14248 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14249 | "Center Playback Switch", |
| 14250 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14251 | HDA_INPUT)); |
| 14252 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14253 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14254 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14255 | "LFE Playback Switch", |
| 14256 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14257 | HDA_INPUT)); |
| 14258 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14259 | return err; |
| 14260 | } else { |
| 14261 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14262 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14263 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14264 | HDA_OUTPUT)); |
| 14265 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14266 | return err; |
| 14267 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14268 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14269 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14270 | HDA_INPUT)); |
| 14271 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14272 | return err; |
| 14273 | } |
| 14274 | } |
| 14275 | return 0; |
| 14276 | } |
| 14277 | |
| 14278 | /* add playback controls for speaker and HP outputs */ |
| 14279 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14280 | * different NIDs for mute/unmute switch and volume control */ |
| 14281 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14282 | hda_nid_t pin, const char *pfx) |
| 14283 | { |
| 14284 | hda_nid_t nid_v, nid_s; |
| 14285 | int err; |
| 14286 | char name[32]; |
| 14287 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14288 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14289 | return 0; |
| 14290 | |
| 14291 | if (alc880_is_fixed_pin(pin)) { |
| 14292 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14293 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14294 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14295 | spec->multiout.hp_nid = nid_v; |
| 14296 | else |
| 14297 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14298 | /* control HP volume/switch on the output mixer amp */ |
| 14299 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14300 | alc880_fixed_pin_idx(pin)); |
| 14301 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14302 | alc880_fixed_pin_idx(pin)); |
| 14303 | |
| 14304 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14305 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14306 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14307 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14308 | return err; |
| 14309 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14310 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14311 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14312 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14313 | return err; |
| 14314 | } else if (alc880_is_multi_pin(pin)) { |
| 14315 | /* set manual connection */ |
| 14316 | /* we have only a switch on HP-out PIN */ |
| 14317 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14318 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14319 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14320 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14321 | return err; |
| 14322 | } |
| 14323 | return 0; |
| 14324 | } |
| 14325 | |
| 14326 | /* parse the BIOS configuration and set up the alc_spec |
| 14327 | * return 1 if successful, 0 if the proper config is not found, |
| 14328 | * or a negative error code |
| 14329 | * Based on ALC880 version - had to change it to override |
| 14330 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 14331 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 14332 | { |
| 14333 | struct alc_spec *spec = codec->spec; |
| 14334 | int err; |
| 14335 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 14336 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14337 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14338 | alc861vd_ignore); |
| 14339 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14340 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14341 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14342 | return 0; /* can't find valid BIOS pin config */ |
| 14343 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14344 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14345 | if (err < 0) |
| 14346 | return err; |
| 14347 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14348 | if (err < 0) |
| 14349 | return err; |
| 14350 | err = alc861vd_auto_create_extra_out(spec, |
| 14351 | spec->autocfg.speaker_pins[0], |
| 14352 | "Speaker"); |
| 14353 | if (err < 0) |
| 14354 | return err; |
| 14355 | err = alc861vd_auto_create_extra_out(spec, |
| 14356 | spec->autocfg.hp_pins[0], |
| 14357 | "Headphone"); |
| 14358 | if (err < 0) |
| 14359 | return err; |
| 14360 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14361 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14362 | return err; |
| 14363 | |
| 14364 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14365 | |
| 14366 | if (spec->autocfg.dig_out_pin) |
| 14367 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 14368 | |
| 14369 | if (spec->kctl_alloc) |
| 14370 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 14371 | |
| 14372 | spec->init_verbs[spec->num_init_verbs++] |
| 14373 | = alc861vd_volume_init_verbs; |
| 14374 | |
| 14375 | spec->num_mux_defs = 1; |
| 14376 | spec->input_mux = &spec->private_imux; |
| 14377 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 14378 | err = alc_auto_add_mic_boost(codec); |
| 14379 | if (err < 0) |
| 14380 | return err; |
| 14381 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14382 | return 1; |
| 14383 | } |
| 14384 | |
| 14385 | /* additional initialization for auto-configuration model */ |
| 14386 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 14387 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14388 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14389 | alc861vd_auto_init_multi_out(codec); |
| 14390 | alc861vd_auto_init_hp_out(codec); |
| 14391 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14392 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14393 | if (spec->unsol_event) |
| 14394 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14395 | } |
| 14396 | |
| 14397 | static int patch_alc861vd(struct hda_codec *codec) |
| 14398 | { |
| 14399 | struct alc_spec *spec; |
| 14400 | int err, board_config; |
| 14401 | |
| 14402 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14403 | if (spec == NULL) |
| 14404 | return -ENOMEM; |
| 14405 | |
| 14406 | codec->spec = spec; |
| 14407 | |
| 14408 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 14409 | alc861vd_models, |
| 14410 | alc861vd_cfg_tbl); |
| 14411 | |
| 14412 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 14413 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 14414 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 14415 | board_config = ALC861VD_AUTO; |
| 14416 | } |
| 14417 | |
| 14418 | if (board_config == ALC861VD_AUTO) { |
| 14419 | /* automatic parse from the BIOS config */ |
| 14420 | err = alc861vd_parse_auto_config(codec); |
| 14421 | if (err < 0) { |
| 14422 | alc_free(codec); |
| 14423 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14424 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14425 | printk(KERN_INFO |
| 14426 | "hda_codec: Cannot set up configuration " |
| 14427 | "from BIOS. Using base mode...\n"); |
| 14428 | board_config = ALC861VD_3ST; |
| 14429 | } |
| 14430 | } |
| 14431 | |
| 14432 | if (board_config != ALC861VD_AUTO) |
| 14433 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 14434 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14435 | if (codec->vendor_id == 0x10ec0660) { |
| 14436 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 14437 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14438 | /* always turn on EAPD */ |
| 14439 | spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14440 | } else { |
| 14441 | spec->stream_name_analog = "ALC861VD Analog"; |
| 14442 | spec->stream_name_digital = "ALC861VD Digital"; |
| 14443 | } |
| 14444 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14445 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 14446 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 14447 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14448 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 14449 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 14450 | |
| 14451 | spec->adc_nids = alc861vd_adc_nids; |
| 14452 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14453 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14454 | |
| 14455 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 14456 | spec->num_mixers++; |
| 14457 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14458 | spec->vmaster_nid = 0x02; |
| 14459 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14460 | codec->patch_ops = alc_patch_ops; |
| 14461 | |
| 14462 | if (board_config == ALC861VD_AUTO) |
| 14463 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14464 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14465 | if (!spec->loopback.amplist) |
| 14466 | spec->loopback.amplist = alc861vd_loopbacks; |
| 14467 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14468 | |
| 14469 | return 0; |
| 14470 | } |
| 14471 | |
| 14472 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14473 | * ALC662 support |
| 14474 | * |
| 14475 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 14476 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 14477 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 14478 | * 6-channel independent captures. |
| 14479 | * |
| 14480 | * In addition, an independent DAC for the multi-playback (not used in this |
| 14481 | * driver yet). |
| 14482 | */ |
| 14483 | #define ALC662_DIGOUT_NID 0x06 |
| 14484 | #define ALC662_DIGIN_NID 0x0a |
| 14485 | |
| 14486 | static hda_nid_t alc662_dac_nids[4] = { |
| 14487 | /* front, rear, clfe, rear_surr */ |
| 14488 | 0x02, 0x03, 0x04 |
| 14489 | }; |
| 14490 | |
| 14491 | static hda_nid_t alc662_adc_nids[1] = { |
| 14492 | /* ADC1-2 */ |
| 14493 | 0x09, |
| 14494 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14495 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 14496 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14497 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14498 | /* input MUX */ |
| 14499 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14500 | static struct hda_input_mux alc662_capture_source = { |
| 14501 | .num_items = 4, |
| 14502 | .items = { |
| 14503 | { "Mic", 0x0 }, |
| 14504 | { "Front Mic", 0x1 }, |
| 14505 | { "Line", 0x2 }, |
| 14506 | { "CD", 0x4 }, |
| 14507 | }, |
| 14508 | }; |
| 14509 | |
| 14510 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 14511 | .num_items = 2, |
| 14512 | .items = { |
| 14513 | { "Mic", 0x1 }, |
| 14514 | { "Line", 0x2 }, |
| 14515 | }, |
| 14516 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14517 | |
| 14518 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 14519 | .num_items = 2, |
| 14520 | .items = { |
| 14521 | { "i-Mic", 0x1 }, |
| 14522 | { "e-Mic", 0x0 }, |
| 14523 | }, |
| 14524 | }; |
| 14525 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14526 | static struct hda_input_mux alc663_capture_source = { |
| 14527 | .num_items = 3, |
| 14528 | .items = { |
| 14529 | { "Mic", 0x0 }, |
| 14530 | { "Front Mic", 0x1 }, |
| 14531 | { "Line", 0x2 }, |
| 14532 | }, |
| 14533 | }; |
| 14534 | |
| 14535 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 14536 | .num_items = 2, |
| 14537 | .items = { |
| 14538 | { "Ext-Mic", 0x0 }, |
| 14539 | { "D-Mic", 0x9 }, |
| 14540 | }, |
| 14541 | }; |
| 14542 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14543 | #define alc662_mux_enum_info alc_mux_enum_info |
| 14544 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14545 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14546 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14547 | /* |
| 14548 | * 2ch mode |
| 14549 | */ |
| 14550 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 14551 | { 2, NULL } |
| 14552 | }; |
| 14553 | |
| 14554 | /* |
| 14555 | * 2ch mode |
| 14556 | */ |
| 14557 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 14558 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 14559 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14560 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 14561 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14562 | { } /* end */ |
| 14563 | }; |
| 14564 | |
| 14565 | /* |
| 14566 | * 6ch mode |
| 14567 | */ |
| 14568 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 14569 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14570 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14571 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 14572 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14573 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14574 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14575 | { } /* end */ |
| 14576 | }; |
| 14577 | |
| 14578 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 14579 | { 2, alc662_3ST_ch2_init }, |
| 14580 | { 6, alc662_3ST_ch6_init }, |
| 14581 | }; |
| 14582 | |
| 14583 | /* |
| 14584 | * 2ch mode |
| 14585 | */ |
| 14586 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 14587 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14588 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14589 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14590 | { } /* end */ |
| 14591 | }; |
| 14592 | |
| 14593 | /* |
| 14594 | * 6ch mode |
| 14595 | */ |
| 14596 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 14597 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14598 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14599 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14600 | { } /* end */ |
| 14601 | }; |
| 14602 | |
| 14603 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 14604 | { 2, alc662_sixstack_ch6_init }, |
| 14605 | { 6, alc662_sixstack_ch8_init }, |
| 14606 | }; |
| 14607 | |
| 14608 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14609 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14610 | */ |
| 14611 | |
| 14612 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 14613 | /* output mixer control */ |
| 14614 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14615 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14616 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14617 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14618 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14619 | 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] | 14620 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14621 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14622 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14623 | |
| 14624 | /*Input mixer control */ |
| 14625 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 14626 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 14627 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 14628 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 14629 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 14630 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 14631 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 14632 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14633 | { } /* end */ |
| 14634 | }; |
| 14635 | |
| 14636 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 14637 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14638 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14639 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14640 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14641 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14642 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14643 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14644 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14645 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14646 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14647 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14648 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14649 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14650 | { } /* end */ |
| 14651 | }; |
| 14652 | |
| 14653 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 14654 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14655 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14656 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14657 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14658 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14659 | 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] | 14660 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14661 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14662 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14663 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14664 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14665 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14666 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14668 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14669 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14670 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14671 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14672 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14673 | { } /* end */ |
| 14674 | }; |
| 14675 | |
| 14676 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 14677 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14678 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14679 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14680 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14681 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14682 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14683 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14684 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14685 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14686 | { } /* end */ |
| 14687 | }; |
| 14688 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14689 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14690 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14691 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 14692 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14693 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14694 | |
| 14695 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 14696 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14697 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14698 | |
| 14699 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 14700 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14701 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14702 | { } /* end */ |
| 14703 | }; |
| 14704 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14705 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 14706 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14707 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14708 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14709 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 14710 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14711 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 14712 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 14713 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14714 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14715 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14716 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14717 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14718 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14719 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14720 | { } /* end */ |
| 14721 | }; |
| 14722 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14723 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 14724 | .ops = &snd_hda_bind_vol, |
| 14725 | .values = { |
| 14726 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 14727 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 14728 | 0 |
| 14729 | }, |
| 14730 | }; |
| 14731 | |
| 14732 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 14733 | .ops = &snd_hda_bind_sw, |
| 14734 | .values = { |
| 14735 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14736 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 14737 | 0 |
| 14738 | }, |
| 14739 | }; |
| 14740 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14741 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14742 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14743 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 14744 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14745 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14746 | { } /* end */ |
| 14747 | }; |
| 14748 | |
| 14749 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 14750 | .ops = &snd_hda_bind_sw, |
| 14751 | .values = { |
| 14752 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14753 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 14754 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 14755 | 0 |
| 14756 | }, |
| 14757 | }; |
| 14758 | |
| 14759 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 14760 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14761 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 14762 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14763 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14764 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14765 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14766 | |
| 14767 | { } /* end */ |
| 14768 | }; |
| 14769 | |
| 14770 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 14771 | .ops = &snd_hda_bind_sw, |
| 14772 | .values = { |
| 14773 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14774 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 14775 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 14776 | 0 |
| 14777 | }, |
| 14778 | }; |
| 14779 | |
| 14780 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 14781 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14782 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 14783 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14784 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14785 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14786 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14787 | { } /* end */ |
| 14788 | }; |
| 14789 | |
| 14790 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14791 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14792 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14793 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14794 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14795 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14796 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14797 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14798 | { } /* end */ |
| 14799 | }; |
| 14800 | |
| 14801 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 14802 | .ops = &snd_hda_bind_vol, |
| 14803 | .values = { |
| 14804 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 14805 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 14806 | 0 |
| 14807 | }, |
| 14808 | }; |
| 14809 | |
| 14810 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 14811 | .ops = &snd_hda_bind_sw, |
| 14812 | .values = { |
| 14813 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14814 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 14815 | 0 |
| 14816 | }, |
| 14817 | }; |
| 14818 | |
| 14819 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 14820 | HDA_BIND_VOL("Master Playback Volume", |
| 14821 | &alc663_asus_two_bind_master_vol), |
| 14822 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 14823 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14824 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14825 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14826 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14827 | { } /* end */ |
| 14828 | }; |
| 14829 | |
| 14830 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 14831 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14832 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 14833 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14834 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14836 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14837 | { } /* end */ |
| 14838 | }; |
| 14839 | |
| 14840 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 14841 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14842 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14843 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14844 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14845 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14846 | |
| 14847 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14848 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14849 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14850 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14851 | { } /* end */ |
| 14852 | }; |
| 14853 | |
| 14854 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 14855 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14856 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14857 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14858 | |
| 14859 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14860 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14861 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14862 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14863 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14864 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14865 | { } /* end */ |
| 14866 | }; |
| 14867 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14868 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 14869 | { |
| 14870 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14871 | .name = "Channel Mode", |
| 14872 | .info = alc_ch_mode_info, |
| 14873 | .get = alc_ch_mode_get, |
| 14874 | .put = alc_ch_mode_put, |
| 14875 | }, |
| 14876 | { } /* end */ |
| 14877 | }; |
| 14878 | |
| 14879 | static struct hda_verb alc662_init_verbs[] = { |
| 14880 | /* ADC: mute amp left and right */ |
| 14881 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14882 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14883 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 14884 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14885 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14886 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14887 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14888 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14889 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14890 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14891 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14892 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14893 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14894 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14895 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14896 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14897 | |
| 14898 | /* Front Pin: output 0 (0x0c) */ |
| 14899 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14900 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14901 | |
| 14902 | /* Rear Pin: output 1 (0x0d) */ |
| 14903 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14904 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14905 | |
| 14906 | /* CLFE Pin: output 2 (0x0e) */ |
| 14907 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14908 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14909 | |
| 14910 | /* Mic (rear) pin: input vref at 80% */ |
| 14911 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14912 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14913 | /* Front Mic pin: input vref at 80% */ |
| 14914 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14915 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14916 | /* Line In pin: input */ |
| 14917 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14918 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14919 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14920 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14921 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14922 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14923 | /* CD pin widget for input */ |
| 14924 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14925 | |
| 14926 | /* FIXME: use matrix-type input source selection */ |
| 14927 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 14928 | /* Input mixer */ |
| 14929 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14930 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14931 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14932 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14933 | |
| 14934 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14935 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14936 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14937 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14938 | |
| 14939 | /* always trun on EAPD */ |
| 14940 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14941 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14942 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14943 | { } |
| 14944 | }; |
| 14945 | |
| 14946 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 14947 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 14948 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14949 | {} |
| 14950 | }; |
| 14951 | |
| 14952 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 14953 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14954 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14955 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14956 | }; |
| 14957 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14958 | /* Set Unsolicited Event*/ |
| 14959 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 14960 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14961 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14962 | {} |
| 14963 | }; |
| 14964 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14965 | /* |
| 14966 | * generic initialization of ADC, input mixers and output mixers |
| 14967 | */ |
| 14968 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 14969 | /* |
| 14970 | * Unmute ADC and set the default input to mic-in |
| 14971 | */ |
| 14972 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14973 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14974 | |
| 14975 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 14976 | * mixer widget |
| 14977 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 14978 | * panel mic (mic 2) |
| 14979 | */ |
| 14980 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14981 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14982 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14983 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14984 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14985 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14986 | |
| 14987 | /* |
| 14988 | * Set up output mixers (0x0c - 0x0f) |
| 14989 | */ |
| 14990 | /* set vol=0 to output mixers */ |
| 14991 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14992 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14993 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14994 | |
| 14995 | /* set up input amps for analog loopback */ |
| 14996 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14997 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14998 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14999 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15000 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15001 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15002 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15003 | |
| 15004 | |
| 15005 | /* FIXME: use matrix-type input source selection */ |
| 15006 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15007 | /* Input mixer */ |
| 15008 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15009 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15010 | { } |
| 15011 | }; |
| 15012 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15013 | /* additional verbs for ALC663 */ |
| 15014 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15015 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15016 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15017 | { } |
| 15018 | }; |
| 15019 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15020 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15021 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15022 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15023 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15024 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15025 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15026 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15027 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15028 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15029 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15030 | {} |
| 15031 | }; |
| 15032 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15033 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15034 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15035 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15036 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15037 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15038 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15039 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15040 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15041 | {} |
| 15042 | }; |
| 15043 | |
| 15044 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15045 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15046 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15047 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15048 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15049 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15050 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15051 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15052 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15053 | {} |
| 15054 | }; |
| 15055 | |
| 15056 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15057 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15058 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15059 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15060 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15061 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15062 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15063 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15064 | {} |
| 15065 | }; |
| 15066 | |
| 15067 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15068 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15069 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15070 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15071 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15072 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15073 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15074 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15075 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15076 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15077 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15078 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15079 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15080 | {} |
| 15081 | }; |
| 15082 | |
| 15083 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15084 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15085 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15086 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15087 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15088 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15089 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15090 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15091 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15092 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15093 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15094 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15095 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15096 | {} |
| 15097 | }; |
| 15098 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15099 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15100 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15101 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15102 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15103 | |
| 15104 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15105 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15106 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15107 | |
| 15108 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15109 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15110 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15111 | {} |
| 15112 | }; |
| 15113 | |
| 15114 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15115 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15116 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15117 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15118 | |
| 15119 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15120 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15121 | {} |
| 15122 | }; |
| 15123 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15124 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15126 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15127 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15128 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15129 | {} |
| 15130 | }; |
| 15131 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15132 | /* capture mixer elements */ |
| 15133 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 15134 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15135 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15136 | { |
| 15137 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15138 | /* The multiple "Capture Source" controls confuse alsamixer |
| 15139 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15140 | */ |
| 15141 | /* .name = "Capture Source", */ |
| 15142 | .name = "Input Source", |
| 15143 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 15144 | .info = alc662_mux_enum_info, |
| 15145 | .get = alc662_mux_enum_get, |
| 15146 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15147 | }, |
| 15148 | { } /* end */ |
| 15149 | }; |
| 15150 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15151 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15152 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15153 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15154 | { } /* end */ |
| 15155 | }; |
| 15156 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15157 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15158 | { |
| 15159 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15160 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15161 | |
| 15162 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15163 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15164 | bits = present ? HDA_AMP_MUTE : 0; |
| 15165 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15166 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15167 | } |
| 15168 | |
| 15169 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15170 | { |
| 15171 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15172 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15173 | |
| 15174 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15175 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15176 | bits = present ? HDA_AMP_MUTE : 0; |
| 15177 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15178 | HDA_AMP_MUTE, bits); |
| 15179 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15180 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15181 | } |
| 15182 | |
| 15183 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15184 | unsigned int res) |
| 15185 | { |
| 15186 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15187 | alc662_lenovo_101e_all_automute(codec); |
| 15188 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15189 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15190 | } |
| 15191 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15192 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15193 | { |
| 15194 | unsigned int present; |
| 15195 | |
| 15196 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15197 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15198 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15199 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15200 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15201 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15202 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15203 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15204 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15205 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15206 | } |
| 15207 | |
| 15208 | /* unsolicited event for HP jack sensing */ |
| 15209 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15210 | unsigned int res) |
| 15211 | { |
| 15212 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15213 | alc262_hippo1_automute( codec ); |
| 15214 | |
| 15215 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15216 | alc662_eeepc_mic_automute(codec); |
| 15217 | } |
| 15218 | |
| 15219 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15220 | { |
| 15221 | alc262_hippo1_automute( codec ); |
| 15222 | alc662_eeepc_mic_automute(codec); |
| 15223 | } |
| 15224 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15225 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 15226 | { |
| 15227 | unsigned int mute; |
| 15228 | unsigned int present; |
| 15229 | |
| 15230 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 15231 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15232 | AC_VERB_GET_PIN_SENSE, 0); |
| 15233 | present = (present & 0x80000000) != 0; |
| 15234 | if (present) { |
| 15235 | /* mute internal speaker */ |
| 15236 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15237 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15238 | } else { |
| 15239 | /* unmute internal speaker if necessary */ |
| 15240 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 15241 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15242 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15243 | } |
| 15244 | } |
| 15245 | |
| 15246 | /* unsolicited event for HP jack sensing */ |
| 15247 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 15248 | unsigned int res) |
| 15249 | { |
| 15250 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15251 | alc662_eeepc_ep20_automute(codec); |
| 15252 | } |
| 15253 | |
| 15254 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15255 | { |
| 15256 | alc662_eeepc_ep20_automute(codec); |
| 15257 | } |
| 15258 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15259 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15260 | { |
| 15261 | unsigned int present; |
| 15262 | unsigned char bits; |
| 15263 | |
| 15264 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15265 | AC_VERB_GET_PIN_SENSE, 0) |
| 15266 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15267 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15268 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15269 | AMP_IN_MUTE(0), bits); |
| 15270 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15271 | AMP_IN_MUTE(0), bits); |
| 15272 | } |
| 15273 | |
| 15274 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15275 | { |
| 15276 | unsigned int present; |
| 15277 | unsigned char bits; |
| 15278 | |
| 15279 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15280 | AC_VERB_GET_PIN_SENSE, 0) |
| 15281 | & AC_PINSENSE_PRESENCE; |
| 15282 | bits = present ? HDA_AMP_MUTE : 0; |
| 15283 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15284 | AMP_IN_MUTE(0), bits); |
| 15285 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15286 | AMP_IN_MUTE(0), bits); |
| 15287 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15288 | AMP_IN_MUTE(0), bits); |
| 15289 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15290 | AMP_IN_MUTE(0), bits); |
| 15291 | } |
| 15292 | |
| 15293 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15294 | { |
| 15295 | unsigned int present; |
| 15296 | unsigned char bits; |
| 15297 | |
| 15298 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15299 | AC_VERB_GET_PIN_SENSE, 0) |
| 15300 | & AC_PINSENSE_PRESENCE; |
| 15301 | bits = present ? HDA_AMP_MUTE : 0; |
| 15302 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15303 | AMP_IN_MUTE(0), bits); |
| 15304 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15305 | AMP_IN_MUTE(0), bits); |
| 15306 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15307 | AMP_IN_MUTE(0), bits); |
| 15308 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15309 | AMP_IN_MUTE(0), bits); |
| 15310 | } |
| 15311 | |
| 15312 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15313 | { |
| 15314 | unsigned int present; |
| 15315 | unsigned char bits; |
| 15316 | |
| 15317 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15318 | AC_VERB_GET_PIN_SENSE, 0) |
| 15319 | & AC_PINSENSE_PRESENCE; |
| 15320 | bits = present ? 0 : PIN_OUT; |
| 15321 | snd_hda_codec_write(codec, 0x14, 0, |
| 15322 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15323 | } |
| 15324 | |
| 15325 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15326 | { |
| 15327 | unsigned int present1, present2; |
| 15328 | |
| 15329 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15330 | AC_VERB_GET_PIN_SENSE, 0) |
| 15331 | & AC_PINSENSE_PRESENCE; |
| 15332 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15333 | AC_VERB_GET_PIN_SENSE, 0) |
| 15334 | & AC_PINSENSE_PRESENCE; |
| 15335 | |
| 15336 | if (present1 || present2) { |
| 15337 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15338 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 15339 | } else { |
| 15340 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15341 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 15342 | } |
| 15343 | } |
| 15344 | |
| 15345 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 15346 | { |
| 15347 | unsigned int present1, present2; |
| 15348 | |
| 15349 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 15350 | AC_VERB_GET_PIN_SENSE, 0) |
| 15351 | & AC_PINSENSE_PRESENCE; |
| 15352 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15353 | AC_VERB_GET_PIN_SENSE, 0) |
| 15354 | & AC_PINSENSE_PRESENCE; |
| 15355 | |
| 15356 | if (present1 || present2) { |
| 15357 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15358 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15359 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15360 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15361 | } else { |
| 15362 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15363 | AMP_IN_MUTE(0), 0); |
| 15364 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15365 | AMP_IN_MUTE(0), 0); |
| 15366 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15367 | } |
| 15368 | |
| 15369 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 15370 | { |
| 15371 | unsigned int present; |
| 15372 | |
| 15373 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15374 | AC_VERB_GET_PIN_SENSE, 0) |
| 15375 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15376 | 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] | 15377 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15378 | 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] | 15379 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15380 | 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] | 15381 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15382 | 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] | 15383 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15384 | } |
| 15385 | |
| 15386 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 15387 | unsigned int res) |
| 15388 | { |
| 15389 | switch (res >> 26) { |
| 15390 | case ALC880_HP_EVENT: |
| 15391 | alc663_m51va_speaker_automute(codec); |
| 15392 | break; |
| 15393 | case ALC880_MIC_EVENT: |
| 15394 | alc663_m51va_mic_automute(codec); |
| 15395 | break; |
| 15396 | } |
| 15397 | } |
| 15398 | |
| 15399 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 15400 | { |
| 15401 | alc663_m51va_speaker_automute(codec); |
| 15402 | alc663_m51va_mic_automute(codec); |
| 15403 | } |
| 15404 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15405 | /* ***************** Mode1 ******************************/ |
| 15406 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 15407 | unsigned int res) |
| 15408 | { |
| 15409 | switch (res >> 26) { |
| 15410 | case ALC880_HP_EVENT: |
| 15411 | alc663_m51va_speaker_automute(codec); |
| 15412 | break; |
| 15413 | case ALC880_MIC_EVENT: |
| 15414 | alc662_eeepc_mic_automute(codec); |
| 15415 | break; |
| 15416 | } |
| 15417 | } |
| 15418 | |
| 15419 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 15420 | { |
| 15421 | alc663_m51va_speaker_automute(codec); |
| 15422 | alc662_eeepc_mic_automute(codec); |
| 15423 | } |
| 15424 | /* ***************** Mode2 ******************************/ |
| 15425 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 15426 | unsigned int res) |
| 15427 | { |
| 15428 | switch (res >> 26) { |
| 15429 | case ALC880_HP_EVENT: |
| 15430 | alc662_f5z_speaker_automute(codec); |
| 15431 | break; |
| 15432 | case ALC880_MIC_EVENT: |
| 15433 | alc662_eeepc_mic_automute(codec); |
| 15434 | break; |
| 15435 | } |
| 15436 | } |
| 15437 | |
| 15438 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 15439 | { |
| 15440 | alc662_f5z_speaker_automute(codec); |
| 15441 | alc662_eeepc_mic_automute(codec); |
| 15442 | } |
| 15443 | /* ***************** Mode3 ******************************/ |
| 15444 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 15445 | unsigned int res) |
| 15446 | { |
| 15447 | switch (res >> 26) { |
| 15448 | case ALC880_HP_EVENT: |
| 15449 | alc663_two_hp_m1_speaker_automute(codec); |
| 15450 | break; |
| 15451 | case ALC880_MIC_EVENT: |
| 15452 | alc662_eeepc_mic_automute(codec); |
| 15453 | break; |
| 15454 | } |
| 15455 | } |
| 15456 | |
| 15457 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 15458 | { |
| 15459 | alc663_two_hp_m1_speaker_automute(codec); |
| 15460 | alc662_eeepc_mic_automute(codec); |
| 15461 | } |
| 15462 | /* ***************** Mode4 ******************************/ |
| 15463 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 15464 | unsigned int res) |
| 15465 | { |
| 15466 | switch (res >> 26) { |
| 15467 | case ALC880_HP_EVENT: |
| 15468 | alc663_21jd_two_speaker_automute(codec); |
| 15469 | break; |
| 15470 | case ALC880_MIC_EVENT: |
| 15471 | alc662_eeepc_mic_automute(codec); |
| 15472 | break; |
| 15473 | } |
| 15474 | } |
| 15475 | |
| 15476 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 15477 | { |
| 15478 | alc663_21jd_two_speaker_automute(codec); |
| 15479 | alc662_eeepc_mic_automute(codec); |
| 15480 | } |
| 15481 | /* ***************** Mode5 ******************************/ |
| 15482 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 15483 | unsigned int res) |
| 15484 | { |
| 15485 | switch (res >> 26) { |
| 15486 | case ALC880_HP_EVENT: |
| 15487 | alc663_15jd_two_speaker_automute(codec); |
| 15488 | break; |
| 15489 | case ALC880_MIC_EVENT: |
| 15490 | alc662_eeepc_mic_automute(codec); |
| 15491 | break; |
| 15492 | } |
| 15493 | } |
| 15494 | |
| 15495 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 15496 | { |
| 15497 | alc663_15jd_two_speaker_automute(codec); |
| 15498 | alc662_eeepc_mic_automute(codec); |
| 15499 | } |
| 15500 | /* ***************** Mode6 ******************************/ |
| 15501 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 15502 | unsigned int res) |
| 15503 | { |
| 15504 | switch (res >> 26) { |
| 15505 | case ALC880_HP_EVENT: |
| 15506 | alc663_two_hp_m2_speaker_automute(codec); |
| 15507 | break; |
| 15508 | case ALC880_MIC_EVENT: |
| 15509 | alc662_eeepc_mic_automute(codec); |
| 15510 | break; |
| 15511 | } |
| 15512 | } |
| 15513 | |
| 15514 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 15515 | { |
| 15516 | alc663_two_hp_m2_speaker_automute(codec); |
| 15517 | alc662_eeepc_mic_automute(codec); |
| 15518 | } |
| 15519 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15520 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 15521 | { |
| 15522 | unsigned int present; |
| 15523 | unsigned char bits; |
| 15524 | |
| 15525 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15526 | AC_VERB_GET_PIN_SENSE, 0) |
| 15527 | & AC_PINSENSE_PRESENCE; |
| 15528 | bits = present ? HDA_AMP_MUTE : 0; |
| 15529 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15530 | HDA_AMP_MUTE, bits); |
| 15531 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15532 | HDA_AMP_MUTE, bits); |
| 15533 | } |
| 15534 | |
| 15535 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 15536 | { |
| 15537 | unsigned int present; |
| 15538 | unsigned char bits; |
| 15539 | |
| 15540 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15541 | AC_VERB_GET_PIN_SENSE, 0) |
| 15542 | & AC_PINSENSE_PRESENCE; |
| 15543 | bits = present ? HDA_AMP_MUTE : 0; |
| 15544 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15545 | HDA_AMP_MUTE, bits); |
| 15546 | } |
| 15547 | |
| 15548 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 15549 | unsigned int res) |
| 15550 | { |
| 15551 | switch (res >> 26) { |
| 15552 | case ALC880_HP_EVENT: |
| 15553 | alc663_g71v_hp_automute(codec); |
| 15554 | break; |
| 15555 | case ALC880_FRONT_EVENT: |
| 15556 | alc663_g71v_front_automute(codec); |
| 15557 | break; |
| 15558 | case ALC880_MIC_EVENT: |
| 15559 | alc662_eeepc_mic_automute(codec); |
| 15560 | break; |
| 15561 | } |
| 15562 | } |
| 15563 | |
| 15564 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 15565 | { |
| 15566 | alc663_g71v_front_automute(codec); |
| 15567 | alc663_g71v_hp_automute(codec); |
| 15568 | alc662_eeepc_mic_automute(codec); |
| 15569 | } |
| 15570 | |
| 15571 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 15572 | unsigned int res) |
| 15573 | { |
| 15574 | switch (res >> 26) { |
| 15575 | case ALC880_HP_EVENT: |
| 15576 | alc663_m51va_speaker_automute(codec); |
| 15577 | break; |
| 15578 | case ALC880_MIC_EVENT: |
| 15579 | alc662_eeepc_mic_automute(codec); |
| 15580 | break; |
| 15581 | } |
| 15582 | } |
| 15583 | |
| 15584 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 15585 | { |
| 15586 | alc663_m51va_speaker_automute(codec); |
| 15587 | alc662_eeepc_mic_automute(codec); |
| 15588 | } |
| 15589 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15590 | /* bind hp and internal speaker mute (with plug check) */ |
| 15591 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 15592 | struct snd_ctl_elem_value *ucontrol) |
| 15593 | { |
| 15594 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 15595 | long *valp = ucontrol->value.integer.value; |
| 15596 | int change; |
| 15597 | |
| 15598 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 15599 | HDA_AMP_MUTE, |
| 15600 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 15601 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 15602 | HDA_AMP_MUTE, |
| 15603 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 15604 | if (change) |
| 15605 | alc262_hippo1_automute(codec); |
| 15606 | return change; |
| 15607 | } |
| 15608 | |
| 15609 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 15610 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15611 | { |
| 15612 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15613 | .name = "Master Playback Switch", |
| 15614 | .info = snd_hda_mixer_amp_switch_info, |
| 15615 | .get = snd_hda_mixer_amp_switch_get, |
| 15616 | .put = alc662_ecs_master_sw_put, |
| 15617 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15618 | }, |
| 15619 | |
| 15620 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 15621 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15622 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15623 | |
| 15624 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15625 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15626 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15627 | { } /* end */ |
| 15628 | }; |
| 15629 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15630 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15631 | #define alc662_loopbacks alc880_loopbacks |
| 15632 | #endif |
| 15633 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15634 | |
| 15635 | /* pcm configuration: identiacal with ALC880 */ |
| 15636 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 15637 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 15638 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 15639 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 15640 | |
| 15641 | /* |
| 15642 | * configuration and preset |
| 15643 | */ |
| 15644 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 15645 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 15646 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 15647 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 15648 | [ALC662_5ST_DIG] = "6stack-dig", |
| 15649 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 15650 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15651 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15652 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15653 | [ALC663_ASUS_M51VA] = "m51va", |
| 15654 | [ALC663_ASUS_G71V] = "g71v", |
| 15655 | [ALC663_ASUS_H13] = "h13", |
| 15656 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15657 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 15658 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 15659 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 15660 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 15661 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 15662 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15663 | [ALC662_AUTO] = "auto", |
| 15664 | }; |
| 15665 | |
| 15666 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15667 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
| 15668 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 15669 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15670 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15671 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15672 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 15673 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), |
| 15674 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 15675 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 15676 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 15677 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15678 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15679 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 15680 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15681 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
| 15682 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 15683 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 15684 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
| 15685 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 15686 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 15687 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
| 15688 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 15689 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
| 15690 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 15691 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 15692 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
| 15693 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 15694 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 15695 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
| 15696 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
| 15697 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 15698 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
| 15699 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 15700 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 15701 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 15702 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15703 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15704 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
| 15705 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15706 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
| 15707 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
| 15708 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15709 | {} |
| 15710 | }; |
| 15711 | |
| 15712 | static struct alc_config_preset alc662_presets[] = { |
| 15713 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15714 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15715 | .init_verbs = { alc662_init_verbs }, |
| 15716 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15717 | .dac_nids = alc662_dac_nids, |
| 15718 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15719 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15720 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15721 | .channel_mode = alc662_3ST_2ch_modes, |
| 15722 | .input_mux = &alc662_capture_source, |
| 15723 | }, |
| 15724 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15725 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 15726 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15727 | .init_verbs = { alc662_init_verbs }, |
| 15728 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15729 | .dac_nids = alc662_dac_nids, |
| 15730 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15731 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15732 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15733 | .channel_mode = alc662_3ST_6ch_modes, |
| 15734 | .need_dac_fix = 1, |
| 15735 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15736 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15737 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15738 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 15739 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15740 | .init_verbs = { alc662_init_verbs }, |
| 15741 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15742 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15743 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15744 | .channel_mode = alc662_3ST_6ch_modes, |
| 15745 | .need_dac_fix = 1, |
| 15746 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15747 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15748 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15749 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 15750 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15751 | .init_verbs = { alc662_init_verbs }, |
| 15752 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15753 | .dac_nids = alc662_dac_nids, |
| 15754 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15755 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15756 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 15757 | .channel_mode = alc662_5stack_modes, |
| 15758 | .input_mux = &alc662_capture_source, |
| 15759 | }, |
| 15760 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15761 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15762 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 15763 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15764 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15765 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15766 | .channel_mode = alc662_3ST_2ch_modes, |
| 15767 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 15768 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 15769 | .init_hook = alc662_lenovo_101e_all_automute, |
| 15770 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15771 | [ALC662_ASUS_EEEPC_P701] = { |
| 15772 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 15773 | .init_verbs = { alc662_init_verbs, |
| 15774 | alc662_eeepc_sue_init_verbs }, |
| 15775 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15776 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15777 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15778 | .channel_mode = alc662_3ST_2ch_modes, |
| 15779 | .input_mux = &alc662_eeepc_capture_source, |
| 15780 | .unsol_event = alc662_eeepc_unsol_event, |
| 15781 | .init_hook = alc662_eeepc_inithook, |
| 15782 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15783 | [ALC662_ASUS_EEEPC_EP20] = { |
| 15784 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 15785 | alc662_chmode_mixer }, |
| 15786 | .init_verbs = { alc662_init_verbs, |
| 15787 | alc662_eeepc_ep20_sue_init_verbs }, |
| 15788 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15789 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15790 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15791 | .channel_mode = alc662_3ST_6ch_modes, |
| 15792 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 15793 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 15794 | .init_hook = alc662_eeepc_ep20_inithook, |
| 15795 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15796 | [ALC662_ECS] = { |
| 15797 | .mixers = { alc662_ecs_mixer, alc662_capture_mixer }, |
| 15798 | .init_verbs = { alc662_init_verbs, |
| 15799 | alc662_ecs_init_verbs }, |
| 15800 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15801 | .dac_nids = alc662_dac_nids, |
| 15802 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15803 | .channel_mode = alc662_3ST_2ch_modes, |
| 15804 | .input_mux = &alc662_eeepc_capture_source, |
| 15805 | .unsol_event = alc662_eeepc_unsol_event, |
| 15806 | .init_hook = alc662_eeepc_inithook, |
| 15807 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15808 | [ALC663_ASUS_M51VA] = { |
| 15809 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 15810 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 15811 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15812 | .dac_nids = alc662_dac_nids, |
| 15813 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15814 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15815 | .channel_mode = alc662_3ST_2ch_modes, |
| 15816 | .input_mux = &alc663_m51va_capture_source, |
| 15817 | .unsol_event = alc663_m51va_unsol_event, |
| 15818 | .init_hook = alc663_m51va_inithook, |
| 15819 | }, |
| 15820 | [ALC663_ASUS_G71V] = { |
| 15821 | .mixers = { alc663_g71v_mixer, alc662_capture_mixer}, |
| 15822 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 15823 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15824 | .dac_nids = alc662_dac_nids, |
| 15825 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15826 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15827 | .channel_mode = alc662_3ST_2ch_modes, |
| 15828 | .input_mux = &alc662_eeepc_capture_source, |
| 15829 | .unsol_event = alc663_g71v_unsol_event, |
| 15830 | .init_hook = alc663_g71v_inithook, |
| 15831 | }, |
| 15832 | [ALC663_ASUS_H13] = { |
| 15833 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 15834 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 15835 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15836 | .dac_nids = alc662_dac_nids, |
| 15837 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15838 | .channel_mode = alc662_3ST_2ch_modes, |
| 15839 | .input_mux = &alc663_m51va_capture_source, |
| 15840 | .unsol_event = alc663_m51va_unsol_event, |
| 15841 | .init_hook = alc663_m51va_inithook, |
| 15842 | }, |
| 15843 | [ALC663_ASUS_G50V] = { |
| 15844 | .mixers = { alc663_g50v_mixer, alc662_capture_mixer}, |
| 15845 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 15846 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15847 | .dac_nids = alc662_dac_nids, |
| 15848 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15849 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15850 | .channel_mode = alc662_3ST_6ch_modes, |
| 15851 | .input_mux = &alc663_capture_source, |
| 15852 | .unsol_event = alc663_g50v_unsol_event, |
| 15853 | .init_hook = alc663_g50v_inithook, |
| 15854 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15855 | [ALC663_ASUS_MODE1] = { |
| 15856 | .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer }, |
| 15857 | .init_verbs = { alc662_init_verbs, |
| 15858 | alc663_21jd_amic_init_verbs }, |
| 15859 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15860 | .hp_nid = 0x03, |
| 15861 | .dac_nids = alc662_dac_nids, |
| 15862 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15863 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15864 | .channel_mode = alc662_3ST_2ch_modes, |
| 15865 | .input_mux = &alc662_eeepc_capture_source, |
| 15866 | .unsol_event = alc663_mode1_unsol_event, |
| 15867 | .init_hook = alc663_mode1_inithook, |
| 15868 | }, |
| 15869 | [ALC662_ASUS_MODE2] = { |
| 15870 | .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer }, |
| 15871 | .init_verbs = { alc662_init_verbs, |
| 15872 | alc662_1bjd_amic_init_verbs }, |
| 15873 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15874 | .dac_nids = alc662_dac_nids, |
| 15875 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15876 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15877 | .channel_mode = alc662_3ST_2ch_modes, |
| 15878 | .input_mux = &alc662_eeepc_capture_source, |
| 15879 | .unsol_event = alc662_mode2_unsol_event, |
| 15880 | .init_hook = alc662_mode2_inithook, |
| 15881 | }, |
| 15882 | [ALC663_ASUS_MODE3] = { |
| 15883 | .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer }, |
| 15884 | .init_verbs = { alc662_init_verbs, |
| 15885 | alc663_two_hp_amic_m1_init_verbs }, |
| 15886 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15887 | .hp_nid = 0x03, |
| 15888 | .dac_nids = alc662_dac_nids, |
| 15889 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15890 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15891 | .channel_mode = alc662_3ST_2ch_modes, |
| 15892 | .input_mux = &alc662_eeepc_capture_source, |
| 15893 | .unsol_event = alc663_mode3_unsol_event, |
| 15894 | .init_hook = alc663_mode3_inithook, |
| 15895 | }, |
| 15896 | [ALC663_ASUS_MODE4] = { |
| 15897 | .mixers = { alc663_asus_21jd_clfe_mixer, |
| 15898 | alc662_auto_capture_mixer}, |
| 15899 | .init_verbs = { alc662_init_verbs, |
| 15900 | alc663_21jd_amic_init_verbs}, |
| 15901 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15902 | .hp_nid = 0x03, |
| 15903 | .dac_nids = alc662_dac_nids, |
| 15904 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15905 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15906 | .channel_mode = alc662_3ST_2ch_modes, |
| 15907 | .input_mux = &alc662_eeepc_capture_source, |
| 15908 | .unsol_event = alc663_mode4_unsol_event, |
| 15909 | .init_hook = alc663_mode4_inithook, |
| 15910 | }, |
| 15911 | [ALC663_ASUS_MODE5] = { |
| 15912 | .mixers = { alc663_asus_15jd_clfe_mixer, |
| 15913 | alc662_auto_capture_mixer }, |
| 15914 | .init_verbs = { alc662_init_verbs, |
| 15915 | alc663_15jd_amic_init_verbs }, |
| 15916 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15917 | .hp_nid = 0x03, |
| 15918 | .dac_nids = alc662_dac_nids, |
| 15919 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15920 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15921 | .channel_mode = alc662_3ST_2ch_modes, |
| 15922 | .input_mux = &alc662_eeepc_capture_source, |
| 15923 | .unsol_event = alc663_mode5_unsol_event, |
| 15924 | .init_hook = alc663_mode5_inithook, |
| 15925 | }, |
| 15926 | [ALC663_ASUS_MODE6] = { |
| 15927 | .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer }, |
| 15928 | .init_verbs = { alc662_init_verbs, |
| 15929 | alc663_two_hp_amic_m2_init_verbs }, |
| 15930 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15931 | .hp_nid = 0x03, |
| 15932 | .dac_nids = alc662_dac_nids, |
| 15933 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15934 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15935 | .channel_mode = alc662_3ST_2ch_modes, |
| 15936 | .input_mux = &alc662_eeepc_capture_source, |
| 15937 | .unsol_event = alc663_mode6_unsol_event, |
| 15938 | .init_hook = alc663_mode6_inithook, |
| 15939 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15940 | }; |
| 15941 | |
| 15942 | |
| 15943 | /* |
| 15944 | * BIOS auto configuration |
| 15945 | */ |
| 15946 | |
| 15947 | /* add playback controls from the parsed DAC table */ |
| 15948 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15949 | const struct auto_pin_cfg *cfg) |
| 15950 | { |
| 15951 | char name[32]; |
| 15952 | static const char *chname[4] = { |
| 15953 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15954 | }; |
| 15955 | hda_nid_t nid; |
| 15956 | int i, err; |
| 15957 | |
| 15958 | for (i = 0; i < cfg->line_outs; i++) { |
| 15959 | if (!spec->multiout.dac_nids[i]) |
| 15960 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15961 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15962 | if (i == 2) { |
| 15963 | /* Center/LFE */ |
| 15964 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15965 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15966 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 15967 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15968 | if (err < 0) |
| 15969 | return err; |
| 15970 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15971 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15972 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 15973 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15974 | if (err < 0) |
| 15975 | return err; |
| 15976 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15977 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15978 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 15979 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15980 | if (err < 0) |
| 15981 | return err; |
| 15982 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15983 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15984 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 15985 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15986 | if (err < 0) |
| 15987 | return err; |
| 15988 | } else { |
| 15989 | sprintf(name, "%s Playback Volume", chname[i]); |
| 15990 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15991 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 15992 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15993 | if (err < 0) |
| 15994 | return err; |
| 15995 | sprintf(name, "%s Playback Switch", chname[i]); |
| 15996 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15997 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 15998 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15999 | if (err < 0) |
| 16000 | return err; |
| 16001 | } |
| 16002 | } |
| 16003 | return 0; |
| 16004 | } |
| 16005 | |
| 16006 | /* add playback controls for speaker and HP outputs */ |
| 16007 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16008 | const char *pfx) |
| 16009 | { |
| 16010 | hda_nid_t nid; |
| 16011 | int err; |
| 16012 | char name[32]; |
| 16013 | |
| 16014 | if (!pin) |
| 16015 | return 0; |
| 16016 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16017 | if (pin == 0x17) { |
| 16018 | /* ALC663 has a mono output pin on 0x17 */ |
| 16019 | sprintf(name, "%s Playback Switch", pfx); |
| 16020 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16021 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16022 | return err; |
| 16023 | } |
| 16024 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16025 | if (alc880_is_fixed_pin(pin)) { |
| 16026 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16027 | /* printk("DAC nid=%x\n",nid); */ |
| 16028 | /* specify the DAC as the extra output */ |
| 16029 | if (!spec->multiout.hp_nid) |
| 16030 | spec->multiout.hp_nid = nid; |
| 16031 | else |
| 16032 | spec->multiout.extra_out_nid[0] = nid; |
| 16033 | /* control HP volume/switch on the output mixer amp */ |
| 16034 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16035 | sprintf(name, "%s Playback Volume", pfx); |
| 16036 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16037 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16038 | if (err < 0) |
| 16039 | return err; |
| 16040 | sprintf(name, "%s Playback Switch", pfx); |
| 16041 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16042 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16043 | if (err < 0) |
| 16044 | return err; |
| 16045 | } else if (alc880_is_multi_pin(pin)) { |
| 16046 | /* set manual connection */ |
| 16047 | /* we have only a switch on HP-out PIN */ |
| 16048 | sprintf(name, "%s Playback Switch", pfx); |
| 16049 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16050 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16051 | if (err < 0) |
| 16052 | return err; |
| 16053 | } |
| 16054 | return 0; |
| 16055 | } |
| 16056 | |
| 16057 | /* create playback/capture controls for input pins */ |
| 16058 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 16059 | const struct auto_pin_cfg *cfg) |
| 16060 | { |
| 16061 | struct hda_input_mux *imux = &spec->private_imux; |
| 16062 | int i, err, idx; |
| 16063 | |
| 16064 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16065 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 16066 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 16067 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16068 | auto_pin_cfg_labels[i], |
| 16069 | idx, 0x0b); |
| 16070 | if (err < 0) |
| 16071 | return err; |
| 16072 | imux->items[imux->num_items].label = |
| 16073 | auto_pin_cfg_labels[i]; |
| 16074 | imux->items[imux->num_items].index = |
| 16075 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 16076 | imux->num_items++; |
| 16077 | } |
| 16078 | } |
| 16079 | return 0; |
| 16080 | } |
| 16081 | |
| 16082 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16083 | hda_nid_t nid, int pin_type, |
| 16084 | int dac_idx) |
| 16085 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16086 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16087 | /* need the manual connection? */ |
| 16088 | if (alc880_is_multi_pin(nid)) { |
| 16089 | struct alc_spec *spec = codec->spec; |
| 16090 | int idx = alc880_multi_pin_idx(nid); |
| 16091 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16092 | AC_VERB_SET_CONNECT_SEL, |
| 16093 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16094 | } |
| 16095 | } |
| 16096 | |
| 16097 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16098 | { |
| 16099 | struct alc_spec *spec = codec->spec; |
| 16100 | int i; |
| 16101 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16102 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16103 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16104 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16105 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16106 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16107 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16108 | i); |
| 16109 | } |
| 16110 | } |
| 16111 | |
| 16112 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16113 | { |
| 16114 | struct alc_spec *spec = codec->spec; |
| 16115 | hda_nid_t pin; |
| 16116 | |
| 16117 | pin = spec->autocfg.hp_pins[0]; |
| 16118 | if (pin) /* connect to front */ |
| 16119 | /* use dac 0 */ |
| 16120 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16121 | pin = spec->autocfg.speaker_pins[0]; |
| 16122 | if (pin) |
| 16123 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16124 | } |
| 16125 | |
| 16126 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 16127 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16128 | |
| 16129 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16130 | { |
| 16131 | struct alc_spec *spec = codec->spec; |
| 16132 | int i; |
| 16133 | |
| 16134 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16135 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 16136 | if (alc662_is_input_pin(nid)) { |
| 16137 | snd_hda_codec_write(codec, nid, 0, |
| 16138 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16139 | (i <= AUTO_PIN_FRONT_MIC ? |
| 16140 | PIN_VREF80 : PIN_IN)); |
| 16141 | if (nid != ALC662_PIN_CD_NID) |
| 16142 | snd_hda_codec_write(codec, nid, 0, |
| 16143 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16144 | AMP_OUT_MUTE); |
| 16145 | } |
| 16146 | } |
| 16147 | } |
| 16148 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16149 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16150 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16151 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16152 | { |
| 16153 | struct alc_spec *spec = codec->spec; |
| 16154 | int err; |
| 16155 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16156 | |
| 16157 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16158 | alc662_ignore); |
| 16159 | if (err < 0) |
| 16160 | return err; |
| 16161 | if (!spec->autocfg.line_outs) |
| 16162 | return 0; /* can't find valid BIOS pin config */ |
| 16163 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16164 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16165 | if (err < 0) |
| 16166 | return err; |
| 16167 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16168 | if (err < 0) |
| 16169 | return err; |
| 16170 | err = alc662_auto_create_extra_out(spec, |
| 16171 | spec->autocfg.speaker_pins[0], |
| 16172 | "Speaker"); |
| 16173 | if (err < 0) |
| 16174 | return err; |
| 16175 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16176 | "Headphone"); |
| 16177 | if (err < 0) |
| 16178 | return err; |
| 16179 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 16180 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16181 | return err; |
| 16182 | |
| 16183 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16184 | |
| 16185 | if (spec->autocfg.dig_out_pin) |
| 16186 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16187 | |
| 16188 | if (spec->kctl_alloc) |
| 16189 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 16190 | |
| 16191 | spec->num_mux_defs = 1; |
| 16192 | spec->input_mux = &spec->private_imux; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16193 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16194 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16195 | if (codec->vendor_id == 0x10ec0663) |
| 16196 | spec->init_verbs[spec->num_init_verbs++] = |
| 16197 | alc663_auto_init_verbs; |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16198 | |
| 16199 | err = alc_auto_add_mic_boost(codec); |
| 16200 | if (err < 0) |
| 16201 | return err; |
| 16202 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16203 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 16204 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16205 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16206 | } |
| 16207 | |
| 16208 | /* additional initialization for auto-configuration model */ |
| 16209 | static void alc662_auto_init(struct hda_codec *codec) |
| 16210 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16211 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16212 | alc662_auto_init_multi_out(codec); |
| 16213 | alc662_auto_init_hp_out(codec); |
| 16214 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16215 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16216 | if (spec->unsol_event) |
| 16217 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16218 | } |
| 16219 | |
| 16220 | static int patch_alc662(struct hda_codec *codec) |
| 16221 | { |
| 16222 | struct alc_spec *spec; |
| 16223 | int err, board_config; |
| 16224 | |
| 16225 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16226 | if (!spec) |
| 16227 | return -ENOMEM; |
| 16228 | |
| 16229 | codec->spec = spec; |
| 16230 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16231 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16232 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16233 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16234 | alc662_models, |
| 16235 | alc662_cfg_tbl); |
| 16236 | if (board_config < 0) { |
| 16237 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16238 | "trying auto-probe from BIOS...\n"); |
| 16239 | board_config = ALC662_AUTO; |
| 16240 | } |
| 16241 | |
| 16242 | if (board_config == ALC662_AUTO) { |
| 16243 | /* automatic parse from the BIOS config */ |
| 16244 | err = alc662_parse_auto_config(codec); |
| 16245 | if (err < 0) { |
| 16246 | alc_free(codec); |
| 16247 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16248 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16249 | printk(KERN_INFO |
| 16250 | "hda_codec: Cannot set up configuration " |
| 16251 | "from BIOS. Using base mode...\n"); |
| 16252 | board_config = ALC662_3ST_2ch_DIG; |
| 16253 | } |
| 16254 | } |
| 16255 | |
| 16256 | if (board_config != ALC662_AUTO) |
| 16257 | setup_preset(spec, &alc662_presets[board_config]); |
| 16258 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16259 | if (codec->vendor_id == 0x10ec0663) { |
| 16260 | spec->stream_name_analog = "ALC663 Analog"; |
| 16261 | spec->stream_name_digital = "ALC663 Digital"; |
| 16262 | } else { |
| 16263 | spec->stream_name_analog = "ALC662 Analog"; |
| 16264 | spec->stream_name_digital = "ALC662 Digital"; |
| 16265 | } |
| 16266 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16267 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16268 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16269 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16270 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16271 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16272 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16273 | spec->adc_nids = alc662_adc_nids; |
| 16274 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16275 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16276 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16277 | spec->vmaster_nid = 0x02; |
| 16278 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16279 | codec->patch_ops = alc_patch_ops; |
| 16280 | if (board_config == ALC662_AUTO) |
| 16281 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16282 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16283 | if (!spec->loopback.amplist) |
| 16284 | spec->loopback.amplist = alc662_loopbacks; |
| 16285 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16286 | |
| 16287 | return 0; |
| 16288 | } |
| 16289 | |
| 16290 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16291 | * patch entries |
| 16292 | */ |
| 16293 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 16294 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16295 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16296 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 16297 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16298 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16299 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16300 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16301 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 16302 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 16303 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16304 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 16305 | .patch = patch_alc883 }, |
| 16306 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 16307 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16308 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16309 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16310 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16311 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 16312 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 16313 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16314 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16315 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16316 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16317 | {} /* terminator */ |
| 16318 | }; |