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; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 287 | struct snd_array kctls; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 288 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 289 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 290 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 291 | /* hooks */ |
| 292 | void (*init_hook)(struct hda_codec *codec); |
| 293 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 294 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 295 | /* for pin sensing */ |
| 296 | unsigned int sense_updated: 1; |
| 297 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 298 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 299 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 300 | /* for virtual master */ |
| 301 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 302 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 303 | struct hda_loopback_check loopback; |
| 304 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 305 | |
| 306 | /* for PLL fix */ |
| 307 | hda_nid_t pll_nid; |
| 308 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 309 | }; |
| 310 | |
| 311 | /* |
| 312 | * configuration template - to be copied to the spec instance |
| 313 | */ |
| 314 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 315 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 316 | * with spec |
| 317 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 318 | const struct hda_verb *init_verbs[5]; |
| 319 | unsigned int num_dacs; |
| 320 | hda_nid_t *dac_nids; |
| 321 | hda_nid_t dig_out_nid; /* optional */ |
| 322 | hda_nid_t hp_nid; /* optional */ |
| 323 | unsigned int num_adc_nids; |
| 324 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 325 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 326 | hda_nid_t dig_in_nid; |
| 327 | unsigned int num_channel_mode; |
| 328 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 329 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 330 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 331 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 332 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 333 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 334 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 335 | struct hda_amp_list *loopbacks; |
| 336 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | }; |
| 338 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | |
| 340 | /* |
| 341 | * input MUX handling |
| 342 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 343 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 344 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | { |
| 346 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 347 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 348 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 349 | if (mux_idx >= spec->num_mux_defs) |
| 350 | mux_idx = 0; |
| 351 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | } |
| 353 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 354 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 355 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | { |
| 357 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 358 | struct alc_spec *spec = codec->spec; |
| 359 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 360 | |
| 361 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 362 | return 0; |
| 363 | } |
| 364 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 365 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 366 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | { |
| 368 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 369 | struct alc_spec *spec = codec->spec; |
| 370 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 371 | 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] | 372 | hda_nid_t nid = spec->capsrc_nids ? |
| 373 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 374 | 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] | 375 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | } |
| 377 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 378 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | /* |
| 380 | * channel mode setting |
| 381 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 382 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 383 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | { |
| 385 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 386 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 387 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 388 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | } |
| 390 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 391 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 392 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 | { |
| 394 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 395 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 396 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 397 | spec->num_channel_mode, |
| 398 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | } |
| 400 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 401 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 402 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | { |
| 404 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 405 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 406 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 407 | spec->num_channel_mode, |
| 408 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 409 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 410 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 411 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | } |
| 413 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 415 | * 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] | 416 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 417 | * being part of a format specifier. Maximum allowed length of a value is |
| 418 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 419 | * |
| 420 | * Note: some retasking pin complexes seem to ignore requests for input |
| 421 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 422 | * are requested. Therefore order this list so that this behaviour will not |
| 423 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 424 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 425 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 426 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 427 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 428 | "Mic 50pc bias", "Mic 80pc bias", |
| 429 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 430 | }; |
| 431 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 432 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 433 | }; |
| 434 | /* 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] | 435 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 436 | * addition, "input" pins may or may not process the mic bias option |
| 437 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 438 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 439 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 440 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 441 | #define ALC_PIN_DIR_IN 0x00 |
| 442 | #define ALC_PIN_DIR_OUT 0x01 |
| 443 | #define ALC_PIN_DIR_INOUT 0x02 |
| 444 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 445 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 446 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 447 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 448 | * For each direction the minimum and maximum values are given. |
| 449 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 450 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 451 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 452 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 453 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 454 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 455 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 456 | }; |
| 457 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 458 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 459 | #define alc_pin_mode_n_items(_dir) \ |
| 460 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 461 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 462 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 463 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 464 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 465 | unsigned int item_num = uinfo->value.enumerated.item; |
| 466 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 467 | |
| 468 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 469 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 470 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 471 | |
| 472 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 473 | item_num = alc_pin_mode_min(dir); |
| 474 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 475 | return 0; |
| 476 | } |
| 477 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 478 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 479 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 480 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 481 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 482 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 483 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 484 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 485 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 486 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 487 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 488 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 489 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 490 | /* Find enumerated value for current pinctl setting */ |
| 491 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 492 | 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] | 493 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 494 | *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] | 495 | return 0; |
| 496 | } |
| 497 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 498 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 499 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 500 | { |
| 501 | signed int change; |
| 502 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 503 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 504 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 505 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 506 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 507 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 508 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 509 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 510 | 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] | 511 | val = alc_pin_mode_min(dir); |
| 512 | |
| 513 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 514 | if (change) { |
| 515 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 516 | snd_hda_codec_write_cache(codec, nid, 0, |
| 517 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 518 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 519 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 520 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 521 | * for the requested pin mode. Enum values of 2 or less are |
| 522 | * input modes. |
| 523 | * |
| 524 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 525 | * reduces noise slightly (particularly on input) so we'll |
| 526 | * do it. However, having both input and output buffers |
| 527 | * enabled simultaneously doesn't seem to be problematic if |
| 528 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 529 | */ |
| 530 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 531 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 532 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 533 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 534 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 535 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 536 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 537 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 538 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 539 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 540 | } |
| 541 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 542 | return change; |
| 543 | } |
| 544 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 545 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 546 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 547 | .info = alc_pin_mode_info, \ |
| 548 | .get = alc_pin_mode_get, \ |
| 549 | .put = alc_pin_mode_put, \ |
| 550 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 551 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 552 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 553 | * together using a mask with more than one bit set. This control is |
| 554 | * currently used only by the ALC260 test model. At this stage they are not |
| 555 | * needed for any "production" models. |
| 556 | */ |
| 557 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 558 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 559 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 561 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 562 | { |
| 563 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 564 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 565 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 566 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 567 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 568 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 569 | |
| 570 | *valp = (val & mask) != 0; |
| 571 | return 0; |
| 572 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 573 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 574 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 575 | { |
| 576 | signed int change; |
| 577 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 578 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 579 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 580 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 581 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 582 | AC_VERB_GET_GPIO_DATA, |
| 583 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 584 | |
| 585 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 586 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 587 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 588 | gpio_data &= ~mask; |
| 589 | else |
| 590 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 591 | snd_hda_codec_write_cache(codec, nid, 0, |
| 592 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 593 | |
| 594 | return change; |
| 595 | } |
| 596 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 597 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 598 | .info = alc_gpio_data_info, \ |
| 599 | .get = alc_gpio_data_get, \ |
| 600 | .put = alc_gpio_data_put, \ |
| 601 | .private_value = nid | (mask<<16) } |
| 602 | #endif /* CONFIG_SND_DEBUG */ |
| 603 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 604 | /* A switch control to allow the enabling of the digital IO pins on the |
| 605 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 606 | * to provide something in the test model allowing digital outputs to be |
| 607 | * identified if present. If models are found which can utilise these |
| 608 | * outputs a more complete mixer control can be devised for those models if |
| 609 | * necessary. |
| 610 | */ |
| 611 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 612 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 613 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 614 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 615 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 616 | { |
| 617 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 618 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 619 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 620 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 621 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 622 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 623 | |
| 624 | *valp = (val & mask) != 0; |
| 625 | return 0; |
| 626 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 627 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 628 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 629 | { |
| 630 | signed int change; |
| 631 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 632 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 633 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 634 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 635 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 636 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 637 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 638 | |
| 639 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 640 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 641 | if (val==0) |
| 642 | ctrl_data &= ~mask; |
| 643 | else |
| 644 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 645 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 646 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 647 | |
| 648 | return change; |
| 649 | } |
| 650 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 651 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 652 | .info = alc_spdif_ctrl_info, \ |
| 653 | .get = alc_spdif_ctrl_get, \ |
| 654 | .put = alc_spdif_ctrl_put, \ |
| 655 | .private_value = nid | (mask<<16) } |
| 656 | #endif /* CONFIG_SND_DEBUG */ |
| 657 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 658 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 659 | * Again, this is only used in the ALC26x test models to help identify when |
| 660 | * the EAPD line must be asserted for features to work. |
| 661 | */ |
| 662 | #ifdef CONFIG_SND_DEBUG |
| 663 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 664 | |
| 665 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 666 | struct snd_ctl_elem_value *ucontrol) |
| 667 | { |
| 668 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 669 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 670 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 671 | long *valp = ucontrol->value.integer.value; |
| 672 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 673 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 674 | |
| 675 | *valp = (val & mask) != 0; |
| 676 | return 0; |
| 677 | } |
| 678 | |
| 679 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 680 | struct snd_ctl_elem_value *ucontrol) |
| 681 | { |
| 682 | int change; |
| 683 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 684 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 685 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 686 | long val = *ucontrol->value.integer.value; |
| 687 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 688 | AC_VERB_GET_EAPD_BTLENABLE, |
| 689 | 0x00); |
| 690 | |
| 691 | /* Set/unset the masked control bit(s) as needed */ |
| 692 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 693 | if (!val) |
| 694 | ctrl_data &= ~mask; |
| 695 | else |
| 696 | ctrl_data |= mask; |
| 697 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 698 | ctrl_data); |
| 699 | |
| 700 | return change; |
| 701 | } |
| 702 | |
| 703 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 704 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 705 | .info = alc_eapd_ctrl_info, \ |
| 706 | .get = alc_eapd_ctrl_get, \ |
| 707 | .put = alc_eapd_ctrl_put, \ |
| 708 | .private_value = nid | (mask<<16) } |
| 709 | #endif /* CONFIG_SND_DEBUG */ |
| 710 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 711 | /* |
| 712 | * set up from the preset table |
| 713 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 714 | static void setup_preset(struct alc_spec *spec, |
| 715 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 716 | { |
| 717 | int i; |
| 718 | |
| 719 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 720 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 721 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 722 | i++) |
| 723 | spec->init_verbs[spec->num_init_verbs++] = |
| 724 | preset->init_verbs[i]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 725 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 726 | spec->channel_mode = preset->channel_mode; |
| 727 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 728 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 729 | |
| 730 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 731 | |
| 732 | spec->multiout.num_dacs = preset->num_dacs; |
| 733 | spec->multiout.dac_nids = preset->dac_nids; |
| 734 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 735 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 736 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 737 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 738 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 739 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 740 | spec->input_mux = preset->input_mux; |
| 741 | |
| 742 | spec->num_adc_nids = preset->num_adc_nids; |
| 743 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 744 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 745 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 746 | |
| 747 | spec->unsol_event = preset->unsol_event; |
| 748 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 749 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 750 | spec->loopback.amplist = preset->loopbacks; |
| 751 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 752 | } |
| 753 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 754 | /* Enable GPIO mask and set output */ |
| 755 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 756 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 757 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 758 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 759 | { } |
| 760 | }; |
| 761 | |
| 762 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 763 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 764 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 765 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 766 | { } |
| 767 | }; |
| 768 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 769 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 770 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 771 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 772 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 773 | { } |
| 774 | }; |
| 775 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 776 | /* |
| 777 | * Fix hardware PLL issue |
| 778 | * On some codecs, the analog PLL gating control must be off while |
| 779 | * the default value is 1. |
| 780 | */ |
| 781 | static void alc_fix_pll(struct hda_codec *codec) |
| 782 | { |
| 783 | struct alc_spec *spec = codec->spec; |
| 784 | unsigned int val; |
| 785 | |
| 786 | if (!spec->pll_nid) |
| 787 | return; |
| 788 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 789 | spec->pll_coef_idx); |
| 790 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 791 | AC_VERB_GET_PROC_COEF, 0); |
| 792 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 793 | spec->pll_coef_idx); |
| 794 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 795 | val & ~(1 << spec->pll_coef_bit)); |
| 796 | } |
| 797 | |
| 798 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 799 | unsigned int coef_idx, unsigned int coef_bit) |
| 800 | { |
| 801 | struct alc_spec *spec = codec->spec; |
| 802 | spec->pll_nid = nid; |
| 803 | spec->pll_coef_idx = coef_idx; |
| 804 | spec->pll_coef_bit = coef_bit; |
| 805 | alc_fix_pll(codec); |
| 806 | } |
| 807 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 808 | static void alc_sku_automute(struct hda_codec *codec) |
| 809 | { |
| 810 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 811 | unsigned int present; |
| 812 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 813 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 814 | |
| 815 | /* need to execute and sync at first */ |
| 816 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 817 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 818 | AC_VERB_GET_PIN_SENSE, 0); |
| 819 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 820 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 821 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 822 | } |
| 823 | |
| 824 | /* unsolicited event for HP jack sensing */ |
| 825 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 826 | { |
| 827 | if (codec->vendor_id == 0x10ec0880) |
| 828 | res >>= 28; |
| 829 | else |
| 830 | res >>= 26; |
| 831 | if (res != ALC880_HP_EVENT) |
| 832 | return; |
| 833 | |
| 834 | alc_sku_automute(codec); |
| 835 | } |
| 836 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 837 | /* additional initialization for ALC888 variants */ |
| 838 | static void alc888_coef_init(struct hda_codec *codec) |
| 839 | { |
| 840 | unsigned int tmp; |
| 841 | |
| 842 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 843 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 844 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 845 | if ((tmp & 0xf0) == 2) |
| 846 | /* alc888S-VC */ |
| 847 | snd_hda_codec_read(codec, 0x20, 0, |
| 848 | AC_VERB_SET_PROC_COEF, 0x830); |
| 849 | else |
| 850 | /* alc888-VB */ |
| 851 | snd_hda_codec_read(codec, 0x20, 0, |
| 852 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 853 | } |
| 854 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 855 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 856 | * 31 ~ 16 : Manufacture ID |
| 857 | * 15 ~ 8 : SKU ID |
| 858 | * 7 ~ 0 : Assembly ID |
| 859 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 860 | */ |
| 861 | static void alc_subsystem_id(struct hda_codec *codec, |
| 862 | unsigned int porta, unsigned int porte, |
| 863 | unsigned int portd) |
| 864 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 865 | unsigned int ass, tmp, i; |
| 866 | unsigned nid; |
| 867 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 868 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 869 | ass = codec->subsystem_id & 0xffff; |
| 870 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 871 | goto do_sku; |
| 872 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 873 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 874 | * 31~30 : port conetcivity |
| 875 | * 29~21 : reserve |
| 876 | * 20 : PCBEEP input |
| 877 | * 19~16 : Check sum (15:1) |
| 878 | * 15~1 : Custom |
| 879 | * 0 : override |
| 880 | */ |
| 881 | nid = 0x1d; |
| 882 | if (codec->vendor_id == 0x10ec0260) |
| 883 | nid = 0x17; |
| 884 | ass = snd_hda_codec_read(codec, nid, 0, |
| 885 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 886 | if (!(ass & 1) && !(ass & 0x100000)) |
| 887 | return; |
| 888 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 889 | return; |
| 890 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 891 | /* check sum */ |
| 892 | tmp = 0; |
| 893 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 894 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 895 | tmp++; |
| 896 | } |
| 897 | if (((ass >> 16) & 0xf) != tmp) |
| 898 | return; |
| 899 | do_sku: |
| 900 | /* |
| 901 | * 0 : override |
| 902 | * 1 : Swap Jack |
| 903 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 904 | * 3~5 : External Amplifier control |
| 905 | * 7~6 : Reserved |
| 906 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 907 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 908 | switch (tmp) { |
| 909 | case 1: |
| 910 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 911 | break; |
| 912 | case 3: |
| 913 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 914 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 915 | case 7: |
| 916 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 917 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 918 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 919 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 920 | case 0x10ec0260: |
| 921 | snd_hda_codec_write(codec, 0x0f, 0, |
| 922 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 923 | snd_hda_codec_write(codec, 0x10, 0, |
| 924 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 925 | break; |
| 926 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 927 | case 0x10ec0267: |
| 928 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 929 | case 0x10ec0269: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 930 | case 0x10ec0660: |
| 931 | case 0x10ec0662: |
| 932 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 933 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 934 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 935 | snd_hda_codec_write(codec, 0x14, 0, |
| 936 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 937 | snd_hda_codec_write(codec, 0x15, 0, |
| 938 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 939 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 940 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 941 | switch (codec->vendor_id) { |
| 942 | case 0x10ec0260: |
| 943 | snd_hda_codec_write(codec, 0x1a, 0, |
| 944 | AC_VERB_SET_COEF_INDEX, 7); |
| 945 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 946 | AC_VERB_GET_PROC_COEF, 0); |
| 947 | snd_hda_codec_write(codec, 0x1a, 0, |
| 948 | AC_VERB_SET_COEF_INDEX, 7); |
| 949 | snd_hda_codec_write(codec, 0x1a, 0, |
| 950 | AC_VERB_SET_PROC_COEF, |
| 951 | tmp | 0x2010); |
| 952 | break; |
| 953 | case 0x10ec0262: |
| 954 | case 0x10ec0880: |
| 955 | case 0x10ec0882: |
| 956 | case 0x10ec0883: |
| 957 | case 0x10ec0885: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 958 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 959 | snd_hda_codec_write(codec, 0x20, 0, |
| 960 | AC_VERB_SET_COEF_INDEX, 7); |
| 961 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 962 | AC_VERB_GET_PROC_COEF, 0); |
| 963 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 964 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 965 | snd_hda_codec_write(codec, 0x20, 0, |
| 966 | AC_VERB_SET_PROC_COEF, |
| 967 | tmp | 0x2010); |
| 968 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 969 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 970 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 971 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 972 | case 0x10ec0267: |
| 973 | case 0x10ec0268: |
| 974 | snd_hda_codec_write(codec, 0x20, 0, |
| 975 | AC_VERB_SET_COEF_INDEX, 7); |
| 976 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 977 | AC_VERB_GET_PROC_COEF, 0); |
| 978 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 979 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 980 | snd_hda_codec_write(codec, 0x20, 0, |
| 981 | AC_VERB_SET_PROC_COEF, |
| 982 | tmp | 0x3000); |
| 983 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 984 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 985 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 986 | break; |
| 987 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 988 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 989 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 990 | * when the external headphone out jack is plugged" |
| 991 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 992 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 993 | return; |
| 994 | /* |
| 995 | * 10~8 : Jack location |
| 996 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 997 | * 14~13: Resvered |
| 998 | * 15 : 1 --> enable the function "Mute internal speaker |
| 999 | * when the external headphone out jack is plugged" |
| 1000 | */ |
| 1001 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1002 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1003 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1004 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1005 | else |
| 1006 | return; |
| 1007 | } |
| 1008 | |
| 1009 | if (!spec->autocfg.hp_pins[0]) { |
| 1010 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1011 | if (tmp == 0) |
| 1012 | spec->autocfg.hp_pins[0] = porta; |
| 1013 | else if (tmp == 1) |
| 1014 | spec->autocfg.hp_pins[0] = porte; |
| 1015 | else if (tmp == 2) |
| 1016 | spec->autocfg.hp_pins[0] = portd; |
| 1017 | else |
| 1018 | return; |
| 1019 | } |
| 1020 | |
| 1021 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1022 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1023 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1024 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1025 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1026 | } |
| 1027 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1028 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1029 | * Fix-up pin default configurations |
| 1030 | */ |
| 1031 | |
| 1032 | struct alc_pincfg { |
| 1033 | hda_nid_t nid; |
| 1034 | u32 val; |
| 1035 | }; |
| 1036 | |
| 1037 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1038 | const struct snd_pci_quirk *quirk, |
| 1039 | const struct alc_pincfg **pinfix) |
| 1040 | { |
| 1041 | const struct alc_pincfg *cfg; |
| 1042 | |
| 1043 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1044 | if (!quirk) |
| 1045 | return; |
| 1046 | |
| 1047 | cfg = pinfix[quirk->value]; |
| 1048 | for (; cfg->nid; cfg++) { |
| 1049 | int i; |
| 1050 | u32 val = cfg->val; |
| 1051 | for (i = 0; i < 4; i++) { |
| 1052 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1053 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1054 | val & 0xff); |
| 1055 | val >>= 8; |
| 1056 | } |
| 1057 | } |
| 1058 | } |
| 1059 | |
| 1060 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1061 | * ALC880 3-stack model |
| 1062 | * |
| 1063 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1064 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1065 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1066 | */ |
| 1067 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1068 | static hda_nid_t alc880_dac_nids[4] = { |
| 1069 | /* front, rear, clfe, rear_surr */ |
| 1070 | 0x02, 0x05, 0x04, 0x03 |
| 1071 | }; |
| 1072 | |
| 1073 | static hda_nid_t alc880_adc_nids[3] = { |
| 1074 | /* ADC0-2 */ |
| 1075 | 0x07, 0x08, 0x09, |
| 1076 | }; |
| 1077 | |
| 1078 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1079 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1080 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1081 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1082 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1083 | /* ADC1-2 */ |
| 1084 | 0x08, 0x09, |
| 1085 | }; |
| 1086 | |
| 1087 | #define ALC880_DIGOUT_NID 0x06 |
| 1088 | #define ALC880_DIGIN_NID 0x0a |
| 1089 | |
| 1090 | static struct hda_input_mux alc880_capture_source = { |
| 1091 | .num_items = 4, |
| 1092 | .items = { |
| 1093 | { "Mic", 0x0 }, |
| 1094 | { "Front Mic", 0x3 }, |
| 1095 | { "Line", 0x2 }, |
| 1096 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1097 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1098 | }; |
| 1099 | |
| 1100 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1101 | /* 2ch mode */ |
| 1102 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1103 | /* set line-in to input, mute it */ |
| 1104 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1105 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1106 | /* set mic-in to input vref 80%, mute it */ |
| 1107 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1108 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1109 | { } /* end */ |
| 1110 | }; |
| 1111 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1112 | /* 6ch mode */ |
| 1113 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1114 | /* set line-in to output, unmute it */ |
| 1115 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1116 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1117 | /* set mic-in to output, unmute it */ |
| 1118 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1119 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1120 | { } /* end */ |
| 1121 | }; |
| 1122 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1123 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1124 | { 2, alc880_threestack_ch2_init }, |
| 1125 | { 6, alc880_threestack_ch6_init }, |
| 1126 | }; |
| 1127 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1128 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1129 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1130 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1131 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1132 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1133 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1134 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1135 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1136 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1137 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1138 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1139 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1140 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1141 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1142 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1143 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1144 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1145 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1146 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1147 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1148 | { |
| 1149 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1150 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1151 | .info = alc_ch_mode_info, |
| 1152 | .get = alc_ch_mode_get, |
| 1153 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1154 | }, |
| 1155 | { } /* end */ |
| 1156 | }; |
| 1157 | |
| 1158 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1159 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1160 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1161 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1162 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1163 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1164 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1165 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1166 | { |
| 1167 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1168 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1169 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1170 | */ |
| 1171 | /* .name = "Capture Source", */ |
| 1172 | .name = "Input Source", |
| 1173 | .count = 3, |
| 1174 | .info = alc_mux_enum_info, |
| 1175 | .get = alc_mux_enum_get, |
| 1176 | .put = alc_mux_enum_put, |
| 1177 | }, |
| 1178 | { } /* end */ |
| 1179 | }; |
| 1180 | |
| 1181 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1182 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1183 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1184 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1185 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1186 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1187 | { |
| 1188 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1189 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1190 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1191 | */ |
| 1192 | /* .name = "Capture Source", */ |
| 1193 | .name = "Input Source", |
| 1194 | .count = 2, |
| 1195 | .info = alc_mux_enum_info, |
| 1196 | .get = alc_mux_enum_get, |
| 1197 | .put = alc_mux_enum_put, |
| 1198 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1199 | { } /* end */ |
| 1200 | }; |
| 1201 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1202 | |
| 1203 | |
| 1204 | /* |
| 1205 | * ALC880 5-stack model |
| 1206 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1207 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1208 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1209 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1210 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1211 | */ |
| 1212 | |
| 1213 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1214 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1215 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1216 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1217 | { } /* end */ |
| 1218 | }; |
| 1219 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1220 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1221 | /* 6ch mode */ |
| 1222 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1223 | /* set line-in to input, mute it */ |
| 1224 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1225 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1226 | { } /* end */ |
| 1227 | }; |
| 1228 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1229 | /* 8ch mode */ |
| 1230 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1231 | /* set line-in to output, unmute it */ |
| 1232 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1233 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1234 | { } /* end */ |
| 1235 | }; |
| 1236 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1237 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1238 | { 6, alc880_fivestack_ch6_init }, |
| 1239 | { 8, alc880_fivestack_ch8_init }, |
| 1240 | }; |
| 1241 | |
| 1242 | |
| 1243 | /* |
| 1244 | * ALC880 6-stack model |
| 1245 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1246 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1247 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1248 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1249 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1250 | */ |
| 1251 | |
| 1252 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1253 | /* front, rear, clfe, rear_surr */ |
| 1254 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1255 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1256 | |
| 1257 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1258 | .num_items = 4, |
| 1259 | .items = { |
| 1260 | { "Mic", 0x0 }, |
| 1261 | { "Front Mic", 0x1 }, |
| 1262 | { "Line", 0x2 }, |
| 1263 | { "CD", 0x4 }, |
| 1264 | }, |
| 1265 | }; |
| 1266 | |
| 1267 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1268 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1269 | { 8, NULL }, |
| 1270 | }; |
| 1271 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1272 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1273 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1274 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1275 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1276 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1277 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1278 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1279 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1280 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1281 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1282 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1283 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1284 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1285 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1286 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1287 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1288 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1289 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1290 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1291 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1292 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1293 | { |
| 1294 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1295 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1296 | .info = alc_ch_mode_info, |
| 1297 | .get = alc_ch_mode_get, |
| 1298 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1299 | }, |
| 1300 | { } /* end */ |
| 1301 | }; |
| 1302 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1303 | |
| 1304 | /* |
| 1305 | * ALC880 W810 model |
| 1306 | * |
| 1307 | * W810 has rear IO for: |
| 1308 | * Front (DAC 02) |
| 1309 | * Surround (DAC 03) |
| 1310 | * Center/LFE (DAC 04) |
| 1311 | * Digital out (06) |
| 1312 | * |
| 1313 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1314 | * 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] | 1315 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1316 | * There is a variable resistor to control the speaker or headphone |
| 1317 | * volume. This is a hardware-only device without a software API. |
| 1318 | * |
| 1319 | * Plugging headphones in will disable the internal speakers. This is |
| 1320 | * implemented in hardware, not via the driver using jack sense. In |
| 1321 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1322 | * disable both the speakers and headphones. |
| 1323 | * |
| 1324 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1325 | * These may not do anything useful with this driver yet, because I |
| 1326 | * haven't setup any initialization verbs for these yet... |
| 1327 | */ |
| 1328 | |
| 1329 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1330 | /* front, rear/surround, clfe */ |
| 1331 | 0x02, 0x03, 0x04 |
| 1332 | }; |
| 1333 | |
| 1334 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1335 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1336 | { 6, NULL } |
| 1337 | }; |
| 1338 | |
| 1339 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1340 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1341 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1342 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1343 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1344 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1345 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1346 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1347 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1348 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1349 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1350 | { } /* end */ |
| 1351 | }; |
| 1352 | |
| 1353 | |
| 1354 | /* |
| 1355 | * Z710V model |
| 1356 | * |
| 1357 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1358 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1359 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1360 | */ |
| 1361 | |
| 1362 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1363 | 0x02 |
| 1364 | }; |
| 1365 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1366 | |
| 1367 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1368 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1369 | { 2, NULL } |
| 1370 | }; |
| 1371 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1372 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1373 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1374 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1375 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1376 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1377 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1378 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1379 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1380 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1381 | { } /* end */ |
| 1382 | }; |
| 1383 | |
| 1384 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1385 | /* |
| 1386 | * ALC880 F1734 model |
| 1387 | * |
| 1388 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1389 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1390 | */ |
| 1391 | |
| 1392 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1393 | 0x03 |
| 1394 | }; |
| 1395 | #define ALC880_F1734_HP_DAC 0x02 |
| 1396 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1397 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1398 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1399 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1400 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1401 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1402 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1403 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1404 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1405 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1406 | { } /* end */ |
| 1407 | }; |
| 1408 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1409 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1410 | .num_items = 2, |
| 1411 | .items = { |
| 1412 | { "Mic", 0x1 }, |
| 1413 | { "CD", 0x4 }, |
| 1414 | }, |
| 1415 | }; |
| 1416 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1417 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1418 | /* |
| 1419 | * ALC880 ASUS model |
| 1420 | * |
| 1421 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1422 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1423 | * Mic = 0x18, Line = 0x1a |
| 1424 | */ |
| 1425 | |
| 1426 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1427 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1428 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1429 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1430 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1431 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1432 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1433 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1434 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1435 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1436 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1437 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1438 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1439 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1440 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1441 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1442 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1443 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1444 | { |
| 1445 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1446 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1447 | .info = alc_ch_mode_info, |
| 1448 | .get = alc_ch_mode_get, |
| 1449 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1450 | }, |
| 1451 | { } /* end */ |
| 1452 | }; |
| 1453 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1454 | /* |
| 1455 | * ALC880 ASUS W1V model |
| 1456 | * |
| 1457 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1458 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1459 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1460 | */ |
| 1461 | |
| 1462 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1463 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1464 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1465 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1466 | { } /* end */ |
| 1467 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1468 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1469 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1470 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1471 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1472 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1473 | { } /* end */ |
| 1474 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1475 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1476 | /* TCL S700 */ |
| 1477 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1478 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1479 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1480 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1481 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1482 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1483 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1484 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1485 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1486 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1487 | { |
| 1488 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1489 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1490 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1491 | */ |
| 1492 | /* .name = "Capture Source", */ |
| 1493 | .name = "Input Source", |
| 1494 | .count = 1, |
| 1495 | .info = alc_mux_enum_info, |
| 1496 | .get = alc_mux_enum_get, |
| 1497 | .put = alc_mux_enum_put, |
| 1498 | }, |
| 1499 | { } /* end */ |
| 1500 | }; |
| 1501 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1502 | /* Uniwill */ |
| 1503 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1504 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1505 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1506 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1507 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1508 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1509 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1510 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1511 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1512 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1513 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1514 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1515 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1516 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1517 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1518 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1519 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1520 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1521 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1522 | { |
| 1523 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1524 | .name = "Channel Mode", |
| 1525 | .info = alc_ch_mode_info, |
| 1526 | .get = alc_ch_mode_get, |
| 1527 | .put = alc_ch_mode_put, |
| 1528 | }, |
| 1529 | { } /* end */ |
| 1530 | }; |
| 1531 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1532 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1533 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1534 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1535 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1536 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1537 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1538 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1539 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1540 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1541 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1542 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1543 | { } /* end */ |
| 1544 | }; |
| 1545 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1546 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1547 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1548 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1549 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1550 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1551 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1552 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1553 | { } /* end */ |
| 1554 | }; |
| 1555 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1556 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1557 | * virtual master controls |
| 1558 | */ |
| 1559 | |
| 1560 | /* |
| 1561 | * slave controls for virtual master |
| 1562 | */ |
| 1563 | static const char *alc_slave_vols[] = { |
| 1564 | "Front Playback Volume", |
| 1565 | "Surround Playback Volume", |
| 1566 | "Center Playback Volume", |
| 1567 | "LFE Playback Volume", |
| 1568 | "Side Playback Volume", |
| 1569 | "Headphone Playback Volume", |
| 1570 | "Speaker Playback Volume", |
| 1571 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1572 | "Line-Out Playback Volume", |
| 1573 | NULL, |
| 1574 | }; |
| 1575 | |
| 1576 | static const char *alc_slave_sws[] = { |
| 1577 | "Front Playback Switch", |
| 1578 | "Surround Playback Switch", |
| 1579 | "Center Playback Switch", |
| 1580 | "LFE Playback Switch", |
| 1581 | "Side Playback Switch", |
| 1582 | "Headphone Playback Switch", |
| 1583 | "Speaker Playback Switch", |
| 1584 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1585 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1586 | NULL, |
| 1587 | }; |
| 1588 | |
| 1589 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1590 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1591 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 1592 | |
| 1593 | static void alc_free_kctls(struct hda_codec *codec); |
| 1594 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1595 | static int alc_build_controls(struct hda_codec *codec) |
| 1596 | { |
| 1597 | struct alc_spec *spec = codec->spec; |
| 1598 | int err; |
| 1599 | int i; |
| 1600 | |
| 1601 | for (i = 0; i < spec->num_mixers; i++) { |
| 1602 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1603 | if (err < 0) |
| 1604 | return err; |
| 1605 | } |
| 1606 | |
| 1607 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1608 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1609 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1610 | if (err < 0) |
| 1611 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1612 | err = snd_hda_create_spdif_share_sw(codec, |
| 1613 | &spec->multiout); |
| 1614 | if (err < 0) |
| 1615 | return err; |
| 1616 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1617 | } |
| 1618 | if (spec->dig_in_nid) { |
| 1619 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1620 | if (err < 0) |
| 1621 | return err; |
| 1622 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1623 | |
| 1624 | /* if we have no master control, let's create it */ |
| 1625 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1626 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1627 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1628 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1629 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1630 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1631 | if (err < 0) |
| 1632 | return err; |
| 1633 | } |
| 1634 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1635 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1636 | NULL, alc_slave_sws); |
| 1637 | if (err < 0) |
| 1638 | return err; |
| 1639 | } |
| 1640 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 1641 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1642 | return 0; |
| 1643 | } |
| 1644 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1645 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1646 | /* |
| 1647 | * initialize the codec volumes, etc |
| 1648 | */ |
| 1649 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1650 | /* |
| 1651 | * generic initialization of ADC, input mixers and output mixers |
| 1652 | */ |
| 1653 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1654 | /* |
| 1655 | * Unmute ADC0-2 and set the default input to mic-in |
| 1656 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1657 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1658 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1659 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1660 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1661 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1662 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1663 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1664 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1665 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1666 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1667 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1668 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1669 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1670 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1671 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1672 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1673 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1674 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1675 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1676 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
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 | /* |
| 1679 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1680 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1681 | /* set vol=0 to output mixers */ |
| 1682 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1683 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1684 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1685 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1686 | /* set up input amps for analog loopback */ |
| 1687 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1688 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1689 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1690 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1691 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1692 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1693 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1694 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1695 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1696 | |
| 1697 | { } |
| 1698 | }; |
| 1699 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1700 | /* |
| 1701 | * 3-stack pin configuration: |
| 1702 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1703 | */ |
| 1704 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1705 | /* |
| 1706 | * preset connection lists of input pins |
| 1707 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1708 | */ |
| 1709 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1710 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1711 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1712 | |
| 1713 | /* |
| 1714 | * Set pin mode and muting |
| 1715 | */ |
| 1716 | /* set front pin widgets 0x14 for output */ |
| 1717 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1718 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1719 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1720 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1721 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1722 | /* Mic2 (as headphone out) for HP output */ |
| 1723 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1724 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1725 | /* Line In pin widget for input */ |
| 1726 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1727 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1728 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1729 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1730 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1731 | /* CD pin widget for input */ |
| 1732 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1733 | |
| 1734 | { } |
| 1735 | }; |
| 1736 | |
| 1737 | /* |
| 1738 | * 5-stack pin configuration: |
| 1739 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1740 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1741 | */ |
| 1742 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1743 | /* |
| 1744 | * preset connection lists of input pins |
| 1745 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1746 | */ |
| 1747 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1748 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1749 | |
| 1750 | /* |
| 1751 | * Set pin mode and muting |
| 1752 | */ |
| 1753 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1754 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1755 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1756 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1757 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1758 | /* unmute pins for output (no gain on this amp) */ |
| 1759 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1760 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1761 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1762 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1763 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1764 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1765 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1766 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1767 | /* Mic2 (as headphone out) for HP output */ |
| 1768 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1769 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1770 | /* Line In pin widget for input */ |
| 1771 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1772 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1773 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1774 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1775 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1776 | /* CD pin widget for input */ |
| 1777 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1778 | |
| 1779 | { } |
| 1780 | }; |
| 1781 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1782 | /* |
| 1783 | * W810 pin configuration: |
| 1784 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1785 | */ |
| 1786 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1787 | /* hphone/speaker input selector: front DAC */ |
| 1788 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1789 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1790 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1791 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1792 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1793 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1794 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1795 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1796 | |
| 1797 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1798 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1799 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1800 | { } |
| 1801 | }; |
| 1802 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1803 | /* |
| 1804 | * Z71V pin configuration: |
| 1805 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1806 | */ |
| 1807 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1808 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1809 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1810 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1811 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1812 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1813 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1814 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1815 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1816 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1817 | |
| 1818 | { } |
| 1819 | }; |
| 1820 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1821 | /* |
| 1822 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1823 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1824 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1825 | */ |
| 1826 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1827 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1828 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1829 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1830 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1831 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1832 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1833 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1834 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1835 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1836 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1837 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1838 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1839 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1840 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1841 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1842 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1843 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1844 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1845 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1846 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1847 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1848 | { } |
| 1849 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1850 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1851 | /* |
| 1852 | * Uniwill pin configuration: |
| 1853 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1854 | * line = 0x1a |
| 1855 | */ |
| 1856 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1857 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1858 | |
| 1859 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1860 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1861 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1862 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1863 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1864 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1865 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1866 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1867 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1868 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1869 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1870 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1871 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1872 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1873 | |
| 1874 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1875 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1876 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1877 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1878 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1879 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1880 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1881 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1882 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1883 | |
| 1884 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1885 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1886 | |
| 1887 | { } |
| 1888 | }; |
| 1889 | |
| 1890 | /* |
| 1891 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1892 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1893 | */ |
| 1894 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1895 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1896 | |
| 1897 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1898 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1899 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1900 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1901 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1902 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1903 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1904 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1905 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1906 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1907 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1908 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1909 | |
| 1910 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1911 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1912 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1913 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1914 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1915 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1916 | |
| 1917 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1918 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1919 | |
| 1920 | { } |
| 1921 | }; |
| 1922 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1923 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1924 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1925 | { } |
| 1926 | }; |
| 1927 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1928 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1929 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1930 | { |
| 1931 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1932 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1933 | |
| 1934 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1935 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1936 | bits = present ? HDA_AMP_MUTE : 0; |
| 1937 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1938 | HDA_AMP_MUTE, bits); |
| 1939 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1940 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1941 | } |
| 1942 | |
| 1943 | /* auto-toggle front mic */ |
| 1944 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1945 | { |
| 1946 | unsigned int present; |
| 1947 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1948 | |
| 1949 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1950 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1951 | bits = present ? HDA_AMP_MUTE : 0; |
| 1952 | 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] | 1953 | } |
| 1954 | |
| 1955 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1956 | { |
| 1957 | alc880_uniwill_hp_automute(codec); |
| 1958 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1959 | } |
| 1960 | |
| 1961 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1962 | unsigned int res) |
| 1963 | { |
| 1964 | /* Looks like the unsol event is incompatible with the standard |
| 1965 | * definition. 4bit tag is placed at 28 bit! |
| 1966 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1967 | switch (res >> 28) { |
| 1968 | case ALC880_HP_EVENT: |
| 1969 | alc880_uniwill_hp_automute(codec); |
| 1970 | break; |
| 1971 | case ALC880_MIC_EVENT: |
| 1972 | alc880_uniwill_mic_automute(codec); |
| 1973 | break; |
| 1974 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1975 | } |
| 1976 | |
| 1977 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1978 | { |
| 1979 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1980 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1981 | |
| 1982 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1983 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1984 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 1985 | 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] | 1986 | } |
| 1987 | |
| 1988 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1989 | { |
| 1990 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1991 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1992 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1993 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1994 | present &= HDA_AMP_VOLMASK; |
| 1995 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1996 | HDA_AMP_VOLMASK, present); |
| 1997 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1998 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1999 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2000 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2001 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2002 | unsigned int res) |
| 2003 | { |
| 2004 | /* Looks like the unsol event is incompatible with the standard |
| 2005 | * definition. 4bit tag is placed at 28 bit! |
| 2006 | */ |
| 2007 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2008 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2009 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2010 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2011 | } |
| 2012 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2013 | /* |
| 2014 | * F1734 pin configuration: |
| 2015 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2016 | */ |
| 2017 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2018 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2019 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2020 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2021 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2022 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2023 | |
| 2024 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2025 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2026 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2028 | |
| 2029 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2030 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2031 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2032 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2033 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2034 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2035 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2036 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2037 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2038 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2039 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2040 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2041 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2042 | { } |
| 2043 | }; |
| 2044 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2045 | /* |
| 2046 | * ASUS pin configuration: |
| 2047 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2048 | */ |
| 2049 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2050 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2051 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2052 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2053 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2054 | |
| 2055 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2056 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2057 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2058 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2059 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2060 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2061 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2062 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2063 | |
| 2064 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2065 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2066 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2067 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2068 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2069 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2070 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2071 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2072 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2073 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2074 | { } |
| 2075 | }; |
| 2076 | |
| 2077 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2078 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2079 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2080 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2081 | /* Clevo m520g init */ |
| 2082 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2083 | /* headphone output */ |
| 2084 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2085 | /* line-out */ |
| 2086 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2087 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2088 | /* Line-in */ |
| 2089 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2090 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2091 | /* CD */ |
| 2092 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2093 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2094 | /* Mic1 (rear panel) */ |
| 2095 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2096 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2097 | /* Mic2 (front panel) */ |
| 2098 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2099 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2100 | /* headphone */ |
| 2101 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2102 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2103 | /* change to EAPD mode */ |
| 2104 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2105 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2106 | |
| 2107 | { } |
| 2108 | }; |
| 2109 | |
| 2110 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2111 | /* change to EAPD mode */ |
| 2112 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2113 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2114 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2115 | /* Headphone output */ |
| 2116 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2117 | /* Front output*/ |
| 2118 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2119 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2120 | |
| 2121 | /* Line In pin widget for input */ |
| 2122 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2123 | /* CD pin widget for input */ |
| 2124 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2125 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2126 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2127 | |
| 2128 | /* change to EAPD mode */ |
| 2129 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2130 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2131 | |
| 2132 | { } |
| 2133 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2134 | |
| 2135 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2136 | * LG m1 express dual |
| 2137 | * |
| 2138 | * Pin assignment: |
| 2139 | * Rear Line-In/Out (blue): 0x14 |
| 2140 | * Build-in Mic-In: 0x15 |
| 2141 | * Speaker-out: 0x17 |
| 2142 | * HP-Out (green): 0x1b |
| 2143 | * Mic-In/Out (red): 0x19 |
| 2144 | * SPDIF-Out: 0x1e |
| 2145 | */ |
| 2146 | |
| 2147 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2148 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2149 | 0x05, 0x02, 0x03 |
| 2150 | }; |
| 2151 | |
| 2152 | /* seems analog CD is not working */ |
| 2153 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2154 | .num_items = 3, |
| 2155 | .items = { |
| 2156 | { "Mic", 0x1 }, |
| 2157 | { "Line", 0x5 }, |
| 2158 | { "Internal Mic", 0x6 }, |
| 2159 | }, |
| 2160 | }; |
| 2161 | |
| 2162 | /* 2,4,6 channel modes */ |
| 2163 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2164 | /* set line-in and mic-in to input */ |
| 2165 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2166 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2167 | { } |
| 2168 | }; |
| 2169 | |
| 2170 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2171 | /* set line-in to out and mic-in to input */ |
| 2172 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2173 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2174 | { } |
| 2175 | }; |
| 2176 | |
| 2177 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2178 | /* set line-in and mic-in to output */ |
| 2179 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2180 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2181 | { } |
| 2182 | }; |
| 2183 | |
| 2184 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2185 | { 2, alc880_lg_ch2_init }, |
| 2186 | { 4, alc880_lg_ch4_init }, |
| 2187 | { 6, alc880_lg_ch6_init }, |
| 2188 | }; |
| 2189 | |
| 2190 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2191 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2192 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2193 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2194 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2195 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2196 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2197 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2198 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2199 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2200 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2201 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2202 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2203 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2204 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2205 | { |
| 2206 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2207 | .name = "Channel Mode", |
| 2208 | .info = alc_ch_mode_info, |
| 2209 | .get = alc_ch_mode_get, |
| 2210 | .put = alc_ch_mode_put, |
| 2211 | }, |
| 2212 | { } /* end */ |
| 2213 | }; |
| 2214 | |
| 2215 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2216 | /* set capture source to mic-in */ |
| 2217 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2218 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2219 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2220 | /* mute all amp mixer inputs */ |
| 2221 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2222 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2223 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2224 | /* line-in to input */ |
| 2225 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2226 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2227 | /* built-in mic */ |
| 2228 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2229 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2230 | /* speaker-out */ |
| 2231 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2232 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2233 | /* mic-in to input */ |
| 2234 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2235 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2236 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2237 | /* HP-out */ |
| 2238 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2239 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2240 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2241 | /* jack sense */ |
| 2242 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2243 | { } |
| 2244 | }; |
| 2245 | |
| 2246 | /* toggle speaker-output according to the hp-jack state */ |
| 2247 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2248 | { |
| 2249 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2250 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2251 | |
| 2252 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2253 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2254 | bits = present ? HDA_AMP_MUTE : 0; |
| 2255 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2256 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2257 | } |
| 2258 | |
| 2259 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2260 | { |
| 2261 | /* Looks like the unsol event is incompatible with the standard |
| 2262 | * definition. 4bit tag is placed at 28 bit! |
| 2263 | */ |
| 2264 | if ((res >> 28) == 0x01) |
| 2265 | alc880_lg_automute(codec); |
| 2266 | } |
| 2267 | |
| 2268 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2269 | * LG LW20 |
| 2270 | * |
| 2271 | * Pin assignment: |
| 2272 | * Speaker-out: 0x14 |
| 2273 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2274 | * Built-in Mic-In: 0x19 |
| 2275 | * Line-In: 0x1b |
| 2276 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2277 | * SPDIF-Out: 0x1e |
| 2278 | */ |
| 2279 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2280 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2281 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2282 | .items = { |
| 2283 | { "Mic", 0x0 }, |
| 2284 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2285 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2286 | }, |
| 2287 | }; |
| 2288 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2289 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2290 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2291 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2292 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2293 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2294 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2295 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2296 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2297 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2298 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2299 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2300 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2301 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2302 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2303 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2304 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2305 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2306 | { |
| 2307 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2308 | .name = "Channel Mode", |
| 2309 | .info = alc_ch_mode_info, |
| 2310 | .get = alc_ch_mode_get, |
| 2311 | .put = alc_ch_mode_put, |
| 2312 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2313 | { } /* end */ |
| 2314 | }; |
| 2315 | |
| 2316 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2317 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2318 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2319 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2320 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2321 | /* set capture source to mic-in */ |
| 2322 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2323 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2324 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2326 | /* speaker-out */ |
| 2327 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2328 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2329 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2330 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2331 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2332 | /* mic-in to input */ |
| 2333 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2334 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2335 | /* built-in mic */ |
| 2336 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2337 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2338 | /* jack sense */ |
| 2339 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2340 | { } |
| 2341 | }; |
| 2342 | |
| 2343 | /* toggle speaker-output according to the hp-jack state */ |
| 2344 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2345 | { |
| 2346 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2347 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2348 | |
| 2349 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2350 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2351 | bits = present ? HDA_AMP_MUTE : 0; |
| 2352 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2353 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2354 | } |
| 2355 | |
| 2356 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2357 | { |
| 2358 | /* Looks like the unsol event is incompatible with the standard |
| 2359 | * definition. 4bit tag is placed at 28 bit! |
| 2360 | */ |
| 2361 | if ((res >> 28) == 0x01) |
| 2362 | alc880_lg_lw_automute(codec); |
| 2363 | } |
| 2364 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2365 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2366 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2367 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2368 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2369 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2370 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2371 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2372 | { } /* end */ |
| 2373 | }; |
| 2374 | |
| 2375 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2376 | .num_items = 2, |
| 2377 | .items = { |
| 2378 | { "Mic", 0x0 }, |
| 2379 | { "Internal Mic", 0x1 }, |
| 2380 | }, |
| 2381 | }; |
| 2382 | |
| 2383 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2384 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2385 | |
| 2386 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2387 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2388 | |
| 2389 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2390 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2391 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2392 | /* Mic2 (as headphone out) for HP output */ |
| 2393 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2394 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2395 | /* Internal Speaker */ |
| 2396 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2397 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2398 | |
| 2399 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2400 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2401 | |
| 2402 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2403 | { } |
| 2404 | }; |
| 2405 | |
| 2406 | /* toggle speaker-output according to the hp-jack state */ |
| 2407 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2408 | { |
| 2409 | unsigned int present; |
| 2410 | unsigned char bits; |
| 2411 | |
| 2412 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2413 | AC_VERB_GET_PIN_SENSE, 0) |
| 2414 | & AC_PINSENSE_PRESENCE; |
| 2415 | bits = present ? HDA_AMP_MUTE : 0; |
| 2416 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2417 | HDA_AMP_MUTE, bits); |
| 2418 | if (present) |
| 2419 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2420 | else |
| 2421 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2422 | } |
| 2423 | |
| 2424 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2425 | unsigned int res) |
| 2426 | { |
| 2427 | /* Looks like the unsol event is incompatible with the standard |
| 2428 | * definition. 4bit tag is placed at 28 bit! |
| 2429 | */ |
| 2430 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2431 | alc880_medion_rim_automute(codec); |
| 2432 | } |
| 2433 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2434 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2435 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2436 | { 0x0b, HDA_INPUT, 0 }, |
| 2437 | { 0x0b, HDA_INPUT, 1 }, |
| 2438 | { 0x0b, HDA_INPUT, 2 }, |
| 2439 | { 0x0b, HDA_INPUT, 3 }, |
| 2440 | { 0x0b, HDA_INPUT, 4 }, |
| 2441 | { } /* end */ |
| 2442 | }; |
| 2443 | |
| 2444 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2445 | { 0x0b, HDA_INPUT, 1 }, |
| 2446 | { 0x0b, HDA_INPUT, 6 }, |
| 2447 | { 0x0b, HDA_INPUT, 7 }, |
| 2448 | { } /* end */ |
| 2449 | }; |
| 2450 | #endif |
| 2451 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2452 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2453 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2454 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2455 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2456 | static int alc_init(struct hda_codec *codec) |
| 2457 | { |
| 2458 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2459 | unsigned int i; |
| 2460 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2461 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2462 | if (codec->vendor_id == 0x10ec0888) |
| 2463 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2464 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2465 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2466 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2467 | |
| 2468 | if (spec->init_hook) |
| 2469 | spec->init_hook(codec); |
| 2470 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2471 | return 0; |
| 2472 | } |
| 2473 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2474 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2475 | { |
| 2476 | struct alc_spec *spec = codec->spec; |
| 2477 | |
| 2478 | if (spec->unsol_event) |
| 2479 | spec->unsol_event(codec, res); |
| 2480 | } |
| 2481 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2482 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2483 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2484 | { |
| 2485 | struct alc_spec *spec = codec->spec; |
| 2486 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2487 | } |
| 2488 | #endif |
| 2489 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2490 | /* |
| 2491 | * Analog playback callbacks |
| 2492 | */ |
| 2493 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2494 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2495 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2496 | { |
| 2497 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2498 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2499 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2500 | } |
| 2501 | |
| 2502 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2503 | struct hda_codec *codec, |
| 2504 | unsigned int stream_tag, |
| 2505 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2506 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2507 | { |
| 2508 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2509 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2510 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2511 | } |
| 2512 | |
| 2513 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2514 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2515 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2516 | { |
| 2517 | struct alc_spec *spec = codec->spec; |
| 2518 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2519 | } |
| 2520 | |
| 2521 | /* |
| 2522 | * Digital out |
| 2523 | */ |
| 2524 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2525 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2526 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2527 | { |
| 2528 | struct alc_spec *spec = codec->spec; |
| 2529 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2530 | } |
| 2531 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2532 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2533 | struct hda_codec *codec, |
| 2534 | unsigned int stream_tag, |
| 2535 | unsigned int format, |
| 2536 | struct snd_pcm_substream *substream) |
| 2537 | { |
| 2538 | struct alc_spec *spec = codec->spec; |
| 2539 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2540 | stream_tag, format, substream); |
| 2541 | } |
| 2542 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2543 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2544 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2545 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2546 | { |
| 2547 | struct alc_spec *spec = codec->spec; |
| 2548 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2549 | } |
| 2550 | |
| 2551 | /* |
| 2552 | * Analog capture |
| 2553 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2554 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2555 | struct hda_codec *codec, |
| 2556 | unsigned int stream_tag, |
| 2557 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2558 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2559 | { |
| 2560 | struct alc_spec *spec = codec->spec; |
| 2561 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2562 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2563 | stream_tag, 0, format); |
| 2564 | return 0; |
| 2565 | } |
| 2566 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2567 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2568 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2569 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2570 | { |
| 2571 | struct alc_spec *spec = codec->spec; |
| 2572 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2573 | snd_hda_codec_cleanup_stream(codec, |
| 2574 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2575 | return 0; |
| 2576 | } |
| 2577 | |
| 2578 | |
| 2579 | /* |
| 2580 | */ |
| 2581 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2582 | .substreams = 1, |
| 2583 | .channels_min = 2, |
| 2584 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2585 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2586 | .ops = { |
| 2587 | .open = alc880_playback_pcm_open, |
| 2588 | .prepare = alc880_playback_pcm_prepare, |
| 2589 | .cleanup = alc880_playback_pcm_cleanup |
| 2590 | }, |
| 2591 | }; |
| 2592 | |
| 2593 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2594 | .substreams = 1, |
| 2595 | .channels_min = 2, |
| 2596 | .channels_max = 2, |
| 2597 | /* NID is set in alc_build_pcms */ |
| 2598 | }; |
| 2599 | |
| 2600 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2601 | .substreams = 1, |
| 2602 | .channels_min = 2, |
| 2603 | .channels_max = 2, |
| 2604 | /* NID is set in alc_build_pcms */ |
| 2605 | }; |
| 2606 | |
| 2607 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2608 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2609 | .channels_min = 2, |
| 2610 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2611 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2612 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2613 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2614 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2615 | }, |
| 2616 | }; |
| 2617 | |
| 2618 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2619 | .substreams = 1, |
| 2620 | .channels_min = 2, |
| 2621 | .channels_max = 2, |
| 2622 | /* NID is set in alc_build_pcms */ |
| 2623 | .ops = { |
| 2624 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2625 | .close = alc880_dig_playback_pcm_close, |
| 2626 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2627 | }, |
| 2628 | }; |
| 2629 | |
| 2630 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2631 | .substreams = 1, |
| 2632 | .channels_min = 2, |
| 2633 | .channels_max = 2, |
| 2634 | /* NID is set in alc_build_pcms */ |
| 2635 | }; |
| 2636 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2637 | /* 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] | 2638 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2639 | .substreams = 0, |
| 2640 | .channels_min = 0, |
| 2641 | .channels_max = 0, |
| 2642 | }; |
| 2643 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2644 | static int alc_build_pcms(struct hda_codec *codec) |
| 2645 | { |
| 2646 | struct alc_spec *spec = codec->spec; |
| 2647 | struct hda_pcm *info = spec->pcm_rec; |
| 2648 | int i; |
| 2649 | |
| 2650 | codec->num_pcms = 1; |
| 2651 | codec->pcm_info = info; |
| 2652 | |
| 2653 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2654 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2655 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 2656 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2657 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2658 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2659 | } |
| 2660 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2661 | if (snd_BUG_ON(!spec->adc_nids)) |
| 2662 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2663 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2664 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2665 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2666 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2667 | if (spec->channel_mode) { |
| 2668 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2669 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2670 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2671 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2672 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2673 | } |
| 2674 | } |
| 2675 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2676 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2677 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2678 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2679 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2680 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2681 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2682 | if (spec->multiout.dig_out_nid && |
| 2683 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2684 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2685 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2686 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2687 | if (spec->dig_in_nid && |
| 2688 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2689 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2690 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2691 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 2692 | /* FIXME: do we need this for all Realtek codec models? */ |
| 2693 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2694 | } |
| 2695 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2696 | /* If the use of more than one ADC is requested for the current |
| 2697 | * model, configure a second analog capture-only PCM. |
| 2698 | */ |
| 2699 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2700 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2701 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2702 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2703 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2704 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2705 | if (spec->alt_dac_nid) { |
| 2706 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2707 | *spec->stream_analog_alt_playback; |
| 2708 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2709 | spec->alt_dac_nid; |
| 2710 | } else { |
| 2711 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2712 | alc_pcm_null_stream; |
| 2713 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2714 | } |
| 2715 | if (spec->num_adc_nids > 1) { |
| 2716 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2717 | *spec->stream_analog_alt_capture; |
| 2718 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2719 | spec->adc_nids[1]; |
| 2720 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2721 | spec->num_adc_nids - 1; |
| 2722 | } else { |
| 2723 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2724 | alc_pcm_null_stream; |
| 2725 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2726 | } |
| 2727 | } |
| 2728 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2729 | return 0; |
| 2730 | } |
| 2731 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 2732 | static void alc_free_kctls(struct hda_codec *codec) |
| 2733 | { |
| 2734 | struct alc_spec *spec = codec->spec; |
| 2735 | |
| 2736 | if (spec->kctls.list) { |
| 2737 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 2738 | int i; |
| 2739 | for (i = 0; i < spec->kctls.used; i++) |
| 2740 | kfree(kctl[i].name); |
| 2741 | } |
| 2742 | snd_array_free(&spec->kctls); |
| 2743 | } |
| 2744 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2745 | static void alc_free(struct hda_codec *codec) |
| 2746 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2747 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2748 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2749 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2750 | return; |
| 2751 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 2752 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2753 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2754 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2755 | } |
| 2756 | |
| 2757 | /* |
| 2758 | */ |
| 2759 | static struct hda_codec_ops alc_patch_ops = { |
| 2760 | .build_controls = alc_build_controls, |
| 2761 | .build_pcms = alc_build_pcms, |
| 2762 | .init = alc_init, |
| 2763 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2764 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2765 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2766 | .check_power_status = alc_check_power_status, |
| 2767 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2768 | }; |
| 2769 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2770 | |
| 2771 | /* |
| 2772 | * Test configuration for debugging |
| 2773 | * |
| 2774 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2775 | * enum controls. |
| 2776 | */ |
| 2777 | #ifdef CONFIG_SND_DEBUG |
| 2778 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2779 | 0x02, 0x03, 0x04, 0x05 |
| 2780 | }; |
| 2781 | |
| 2782 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2783 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2784 | .items = { |
| 2785 | { "In-1", 0x0 }, |
| 2786 | { "In-2", 0x1 }, |
| 2787 | { "In-3", 0x2 }, |
| 2788 | { "In-4", 0x3 }, |
| 2789 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2790 | { "Front", 0x5 }, |
| 2791 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2792 | }, |
| 2793 | }; |
| 2794 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2795 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2796 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2797 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2798 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2799 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2800 | }; |
| 2801 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2802 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2803 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2804 | { |
| 2805 | static char *texts[] = { |
| 2806 | "N/A", "Line Out", "HP Out", |
| 2807 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2808 | }; |
| 2809 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2810 | uinfo->count = 1; |
| 2811 | uinfo->value.enumerated.items = 8; |
| 2812 | if (uinfo->value.enumerated.item >= 8) |
| 2813 | uinfo->value.enumerated.item = 7; |
| 2814 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2815 | return 0; |
| 2816 | } |
| 2817 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2818 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2819 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2820 | { |
| 2821 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2822 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2823 | unsigned int pin_ctl, item = 0; |
| 2824 | |
| 2825 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2826 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2827 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2828 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2829 | item = 2; |
| 2830 | else |
| 2831 | item = 1; |
| 2832 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2833 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2834 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2835 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2836 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2837 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2838 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2839 | } |
| 2840 | } |
| 2841 | ucontrol->value.enumerated.item[0] = item; |
| 2842 | return 0; |
| 2843 | } |
| 2844 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2845 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2846 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2847 | { |
| 2848 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2849 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2850 | static unsigned int ctls[] = { |
| 2851 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2852 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2853 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2854 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2855 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2856 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2857 | }; |
| 2858 | unsigned int old_ctl, new_ctl; |
| 2859 | |
| 2860 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2861 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2862 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2863 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2864 | int val; |
| 2865 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2866 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2867 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2868 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2869 | HDA_AMP_MUTE : 0; |
| 2870 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2871 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2872 | return 1; |
| 2873 | } |
| 2874 | return 0; |
| 2875 | } |
| 2876 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2877 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2878 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2879 | { |
| 2880 | static char *texts[] = { |
| 2881 | "Front", "Surround", "CLFE", "Side" |
| 2882 | }; |
| 2883 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2884 | uinfo->count = 1; |
| 2885 | uinfo->value.enumerated.items = 4; |
| 2886 | if (uinfo->value.enumerated.item >= 4) |
| 2887 | uinfo->value.enumerated.item = 3; |
| 2888 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2889 | return 0; |
| 2890 | } |
| 2891 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2892 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2893 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2894 | { |
| 2895 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2896 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2897 | unsigned int sel; |
| 2898 | |
| 2899 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2900 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2901 | return 0; |
| 2902 | } |
| 2903 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2904 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2905 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2906 | { |
| 2907 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2908 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2909 | unsigned int sel; |
| 2910 | |
| 2911 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2912 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2913 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2914 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2915 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2916 | return 1; |
| 2917 | } |
| 2918 | return 0; |
| 2919 | } |
| 2920 | |
| 2921 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2922 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2923 | .name = xname, \ |
| 2924 | .info = alc_test_pin_ctl_info, \ |
| 2925 | .get = alc_test_pin_ctl_get, \ |
| 2926 | .put = alc_test_pin_ctl_put, \ |
| 2927 | .private_value = nid \ |
| 2928 | } |
| 2929 | |
| 2930 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2931 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2932 | .name = xname, \ |
| 2933 | .info = alc_test_pin_src_info, \ |
| 2934 | .get = alc_test_pin_src_get, \ |
| 2935 | .put = alc_test_pin_src_put, \ |
| 2936 | .private_value = nid \ |
| 2937 | } |
| 2938 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2939 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2940 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2941 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2942 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2943 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2944 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2945 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2946 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2947 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2948 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2949 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2950 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2951 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2952 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2953 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2954 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2955 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2956 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2957 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2958 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2959 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2960 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2961 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2962 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2963 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2964 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2965 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2966 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2967 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2968 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2969 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2970 | { |
| 2971 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2972 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2973 | .info = alc_ch_mode_info, |
| 2974 | .get = alc_ch_mode_get, |
| 2975 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2976 | }, |
| 2977 | { } /* end */ |
| 2978 | }; |
| 2979 | |
| 2980 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2981 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2982 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2983 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2984 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2985 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2986 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2987 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2988 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2989 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2990 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2991 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2992 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2993 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2994 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2995 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2996 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2997 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2998 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2999 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3000 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3001 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3002 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3003 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3004 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3005 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3006 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3007 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3008 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3009 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3010 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3011 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3012 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3013 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3014 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3015 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3016 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3017 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3018 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3019 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3020 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3021 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3022 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3023 | /* Analog input/passthru */ |
| 3024 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3025 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3026 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3027 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3028 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3029 | { } |
| 3030 | }; |
| 3031 | #endif |
| 3032 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3033 | /* |
| 3034 | */ |
| 3035 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3036 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3037 | [ALC880_3ST] = "3stack", |
| 3038 | [ALC880_TCL_S700] = "tcl", |
| 3039 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3040 | [ALC880_CLEVO] = "clevo", |
| 3041 | [ALC880_5ST] = "5stack", |
| 3042 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3043 | [ALC880_W810] = "w810", |
| 3044 | [ALC880_Z71V] = "z71v", |
| 3045 | [ALC880_6ST] = "6stack", |
| 3046 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3047 | [ALC880_ASUS] = "asus", |
| 3048 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3049 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3050 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3051 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3052 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3053 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3054 | [ALC880_F1734] = "F1734", |
| 3055 | [ALC880_LG] = "lg", |
| 3056 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3057 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3058 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3059 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3060 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3061 | [ALC880_AUTO] = "auto", |
| 3062 | }; |
| 3063 | |
| 3064 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3065 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3066 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3067 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3068 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3069 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3070 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3071 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3072 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3073 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3074 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3075 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3076 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3077 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3078 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3079 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3080 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3081 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3082 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3083 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3084 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3085 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3086 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3087 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3088 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3089 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3090 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3091 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3092 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3093 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3094 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3095 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3096 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3097 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3098 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3099 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3100 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3101 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3102 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3103 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3104 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3105 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3106 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3107 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3108 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3109 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3110 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3111 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3112 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3113 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3114 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3115 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3116 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3117 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3118 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3119 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3120 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3121 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3122 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3123 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3124 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3125 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3126 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3127 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3128 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3129 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3130 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3131 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3132 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3133 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3134 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3135 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3136 | {} |
| 3137 | }; |
| 3138 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3139 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3140 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3141 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3142 | static struct alc_config_preset alc880_presets[] = { |
| 3143 | [ALC880_3ST] = { |
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, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3149 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3150 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3151 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3152 | .input_mux = &alc880_capture_source, |
| 3153 | }, |
| 3154 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3155 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3156 | .init_verbs = { alc880_volume_init_verbs, |
| 3157 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3158 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3159 | .dac_nids = alc880_dac_nids, |
| 3160 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3161 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3162 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3163 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3164 | .input_mux = &alc880_capture_source, |
| 3165 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3166 | [ALC880_TCL_S700] = { |
| 3167 | .mixers = { alc880_tcl_s700_mixer }, |
| 3168 | .init_verbs = { alc880_volume_init_verbs, |
| 3169 | alc880_pin_tcl_S700_init_verbs, |
| 3170 | alc880_gpio2_init_verbs }, |
| 3171 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3172 | .dac_nids = alc880_dac_nids, |
| 3173 | .hp_nid = 0x03, |
| 3174 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3175 | .channel_mode = alc880_2_jack_modes, |
| 3176 | .input_mux = &alc880_capture_source, |
| 3177 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3178 | [ALC880_5ST] = { |
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, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3185 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3186 | .channel_mode = alc880_fivestack_modes, |
| 3187 | .input_mux = &alc880_capture_source, |
| 3188 | }, |
| 3189 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3190 | .mixers = { alc880_three_stack_mixer, |
| 3191 | alc880_five_stack_mixer }, |
| 3192 | .init_verbs = { alc880_volume_init_verbs, |
| 3193 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3194 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3195 | .dac_nids = alc880_dac_nids, |
| 3196 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3197 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3198 | .channel_mode = alc880_fivestack_modes, |
| 3199 | .input_mux = &alc880_capture_source, |
| 3200 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3201 | [ALC880_6ST] = { |
| 3202 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3203 | .init_verbs = { alc880_volume_init_verbs, |
| 3204 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3205 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3206 | .dac_nids = alc880_6st_dac_nids, |
| 3207 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3208 | .channel_mode = alc880_sixstack_modes, |
| 3209 | .input_mux = &alc880_6stack_capture_source, |
| 3210 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3211 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3212 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3213 | .init_verbs = { alc880_volume_init_verbs, |
| 3214 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3215 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3216 | .dac_nids = alc880_6st_dac_nids, |
| 3217 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3218 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3219 | .channel_mode = alc880_sixstack_modes, |
| 3220 | .input_mux = &alc880_6stack_capture_source, |
| 3221 | }, |
| 3222 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3223 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3224 | .init_verbs = { alc880_volume_init_verbs, |
| 3225 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3226 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3227 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3228 | .dac_nids = alc880_w810_dac_nids, |
| 3229 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3230 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3231 | .channel_mode = alc880_w810_modes, |
| 3232 | .input_mux = &alc880_capture_source, |
| 3233 | }, |
| 3234 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3235 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3236 | .init_verbs = { alc880_volume_init_verbs, |
| 3237 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3238 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3239 | .dac_nids = alc880_z71v_dac_nids, |
| 3240 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3241 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3242 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3243 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3244 | .input_mux = &alc880_capture_source, |
| 3245 | }, |
| 3246 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3247 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3248 | .init_verbs = { alc880_volume_init_verbs, |
| 3249 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3250 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3251 | .dac_nids = alc880_f1734_dac_nids, |
| 3252 | .hp_nid = 0x02, |
| 3253 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3254 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3255 | .input_mux = &alc880_f1734_capture_source, |
| 3256 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3257 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3258 | }, |
| 3259 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3260 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3261 | .init_verbs = { alc880_volume_init_verbs, |
| 3262 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3263 | alc880_gpio1_init_verbs }, |
| 3264 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3265 | .dac_nids = alc880_asus_dac_nids, |
| 3266 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3267 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3268 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3269 | .input_mux = &alc880_capture_source, |
| 3270 | }, |
| 3271 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3272 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3273 | .init_verbs = { alc880_volume_init_verbs, |
| 3274 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3275 | alc880_gpio1_init_verbs }, |
| 3276 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3277 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3278 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3279 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3280 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3281 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3282 | .input_mux = &alc880_capture_source, |
| 3283 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3284 | [ALC880_ASUS_DIG2] = { |
| 3285 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3286 | .init_verbs = { alc880_volume_init_verbs, |
| 3287 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3288 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3289 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3290 | .dac_nids = alc880_asus_dac_nids, |
| 3291 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3292 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3293 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3294 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3295 | .input_mux = &alc880_capture_source, |
| 3296 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3297 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3298 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3299 | .init_verbs = { alc880_volume_init_verbs, |
| 3300 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3301 | alc880_gpio1_init_verbs }, |
| 3302 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3303 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3304 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3305 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3306 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3307 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3308 | .input_mux = &alc880_capture_source, |
| 3309 | }, |
| 3310 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3311 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3312 | .init_verbs = { alc880_volume_init_verbs, |
| 3313 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3314 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3315 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3316 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3317 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3318 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3319 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3320 | .input_mux = &alc880_capture_source, |
| 3321 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3322 | [ALC880_UNIWILL] = { |
| 3323 | .mixers = { alc880_uniwill_mixer }, |
| 3324 | .init_verbs = { alc880_volume_init_verbs, |
| 3325 | alc880_uniwill_init_verbs }, |
| 3326 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3327 | .dac_nids = alc880_asus_dac_nids, |
| 3328 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3329 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3330 | .channel_mode = alc880_threestack_modes, |
| 3331 | .need_dac_fix = 1, |
| 3332 | .input_mux = &alc880_capture_source, |
| 3333 | .unsol_event = alc880_uniwill_unsol_event, |
| 3334 | .init_hook = alc880_uniwill_automute, |
| 3335 | }, |
| 3336 | [ALC880_UNIWILL_P53] = { |
| 3337 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3338 | .init_verbs = { alc880_volume_init_verbs, |
| 3339 | alc880_uniwill_p53_init_verbs }, |
| 3340 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3341 | .dac_nids = alc880_asus_dac_nids, |
| 3342 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3343 | .channel_mode = alc880_threestack_modes, |
| 3344 | .input_mux = &alc880_capture_source, |
| 3345 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3346 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3347 | }, |
| 3348 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3349 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3350 | alc880_pcbeep_mixer, }, |
| 3351 | .init_verbs = { alc880_volume_init_verbs, |
| 3352 | alc880_uniwill_p53_init_verbs, |
| 3353 | alc880_beep_init_verbs }, |
| 3354 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3355 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3356 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3357 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3358 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3359 | .input_mux = &alc880_capture_source, |
| 3360 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3361 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3362 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3363 | [ALC880_CLEVO] = { |
| 3364 | .mixers = { alc880_three_stack_mixer }, |
| 3365 | .init_verbs = { alc880_volume_init_verbs, |
| 3366 | alc880_pin_clevo_init_verbs }, |
| 3367 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3368 | .dac_nids = alc880_dac_nids, |
| 3369 | .hp_nid = 0x03, |
| 3370 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3371 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3372 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3373 | .input_mux = &alc880_capture_source, |
| 3374 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3375 | [ALC880_LG] = { |
| 3376 | .mixers = { alc880_lg_mixer }, |
| 3377 | .init_verbs = { alc880_volume_init_verbs, |
| 3378 | alc880_lg_init_verbs }, |
| 3379 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3380 | .dac_nids = alc880_lg_dac_nids, |
| 3381 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3382 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3383 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3384 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3385 | .input_mux = &alc880_lg_capture_source, |
| 3386 | .unsol_event = alc880_lg_unsol_event, |
| 3387 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3388 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3389 | .loopbacks = alc880_lg_loopbacks, |
| 3390 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3391 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3392 | [ALC880_LG_LW] = { |
| 3393 | .mixers = { alc880_lg_lw_mixer }, |
| 3394 | .init_verbs = { alc880_volume_init_verbs, |
| 3395 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3396 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3397 | .dac_nids = alc880_dac_nids, |
| 3398 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3399 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3400 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3401 | .input_mux = &alc880_lg_lw_capture_source, |
| 3402 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3403 | .init_hook = alc880_lg_lw_automute, |
| 3404 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3405 | [ALC880_MEDION_RIM] = { |
| 3406 | .mixers = { alc880_medion_rim_mixer }, |
| 3407 | .init_verbs = { alc880_volume_init_verbs, |
| 3408 | alc880_medion_rim_init_verbs, |
| 3409 | alc_gpio2_init_verbs }, |
| 3410 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3411 | .dac_nids = alc880_dac_nids, |
| 3412 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3413 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3414 | .channel_mode = alc880_2_jack_modes, |
| 3415 | .input_mux = &alc880_medion_rim_capture_source, |
| 3416 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3417 | .init_hook = alc880_medion_rim_automute, |
| 3418 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3419 | #ifdef CONFIG_SND_DEBUG |
| 3420 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3421 | .mixers = { alc880_test_mixer }, |
| 3422 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3423 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3424 | .dac_nids = alc880_test_dac_nids, |
| 3425 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3426 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3427 | .channel_mode = alc880_test_modes, |
| 3428 | .input_mux = &alc880_test_capture_source, |
| 3429 | }, |
| 3430 | #endif |
| 3431 | }; |
| 3432 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3433 | /* |
| 3434 | * Automatic parse of I/O pins from the BIOS configuration |
| 3435 | */ |
| 3436 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3437 | enum { |
| 3438 | ALC_CTL_WIDGET_VOL, |
| 3439 | ALC_CTL_WIDGET_MUTE, |
| 3440 | ALC_CTL_BIND_MUTE, |
| 3441 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3442 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3443 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3444 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3445 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3446 | }; |
| 3447 | |
| 3448 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3449 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3450 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3451 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3452 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3453 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 3454 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 3455 | knew = snd_array_new(&spec->kctls); |
| 3456 | if (!knew) |
| 3457 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3458 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3459 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3460 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3461 | return -ENOMEM; |
| 3462 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3463 | return 0; |
| 3464 | } |
| 3465 | |
| 3466 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3467 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3468 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3469 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3470 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3471 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3472 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3473 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3474 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3475 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3476 | #define ALC880_PIN_CD_NID 0x1c |
| 3477 | |
| 3478 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3479 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3480 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3481 | { |
| 3482 | hda_nid_t nid; |
| 3483 | int assigned[4]; |
| 3484 | int i, j; |
| 3485 | |
| 3486 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3487 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3488 | |
| 3489 | /* check the pins hardwired to audio widget */ |
| 3490 | for (i = 0; i < cfg->line_outs; i++) { |
| 3491 | nid = cfg->line_out_pins[i]; |
| 3492 | if (alc880_is_fixed_pin(nid)) { |
| 3493 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3494 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3495 | assigned[idx] = 1; |
| 3496 | } |
| 3497 | } |
| 3498 | /* left pins can be connect to any audio widget */ |
| 3499 | for (i = 0; i < cfg->line_outs; i++) { |
| 3500 | nid = cfg->line_out_pins[i]; |
| 3501 | if (alc880_is_fixed_pin(nid)) |
| 3502 | continue; |
| 3503 | /* search for an empty channel */ |
| 3504 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3505 | if (!assigned[j]) { |
| 3506 | spec->multiout.dac_nids[i] = |
| 3507 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3508 | assigned[j] = 1; |
| 3509 | break; |
| 3510 | } |
| 3511 | } |
| 3512 | } |
| 3513 | spec->multiout.num_dacs = cfg->line_outs; |
| 3514 | return 0; |
| 3515 | } |
| 3516 | |
| 3517 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3518 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3519 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3520 | { |
| 3521 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3522 | static const char *chname[4] = { |
| 3523 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3524 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3525 | hda_nid_t nid; |
| 3526 | int i, err; |
| 3527 | |
| 3528 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3529 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3530 | continue; |
| 3531 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3532 | if (i == 2) { |
| 3533 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3534 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3535 | "Center Playback Volume", |
| 3536 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3537 | HDA_OUTPUT)); |
| 3538 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3539 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3540 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3541 | "LFE Playback Volume", |
| 3542 | HDA_COMPOSE_AMP_VAL(nid, 2, 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_BIND_MUTE, |
| 3547 | "Center Playback Switch", |
| 3548 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3549 | HDA_INPUT)); |
| 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 | "LFE Playback Switch", |
| 3554 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3555 | HDA_INPUT)); |
| 3556 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3557 | return err; |
| 3558 | } else { |
| 3559 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3560 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3561 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3562 | HDA_OUTPUT)); |
| 3563 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3564 | return err; |
| 3565 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3566 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3567 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3568 | HDA_INPUT)); |
| 3569 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3570 | return err; |
| 3571 | } |
| 3572 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3573 | return 0; |
| 3574 | } |
| 3575 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3576 | /* add playback controls for speaker and HP outputs */ |
| 3577 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3578 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3579 | { |
| 3580 | hda_nid_t nid; |
| 3581 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3582 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3583 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3584 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3585 | return 0; |
| 3586 | |
| 3587 | if (alc880_is_fixed_pin(pin)) { |
| 3588 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3589 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3590 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3591 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3592 | else |
| 3593 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3594 | /* control HP volume/switch on the output mixer amp */ |
| 3595 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3596 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3597 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3598 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3599 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3600 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3601 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3602 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3603 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3604 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3605 | return err; |
| 3606 | } else if (alc880_is_multi_pin(pin)) { |
| 3607 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3608 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3609 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3610 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3611 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3612 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3613 | return err; |
| 3614 | } |
| 3615 | return 0; |
| 3616 | } |
| 3617 | |
| 3618 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3619 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3620 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3621 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3622 | { |
| 3623 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3624 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3625 | |
| 3626 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3627 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3628 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3629 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3630 | return err; |
| 3631 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3632 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3633 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3634 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3635 | return err; |
| 3636 | return 0; |
| 3637 | } |
| 3638 | |
| 3639 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3640 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3641 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3642 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3643 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3644 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3645 | |
| 3646 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3647 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3648 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3649 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3650 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3651 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3652 | if (err < 0) |
| 3653 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3654 | imux->items[imux->num_items].label = |
| 3655 | auto_pin_cfg_labels[i]; |
| 3656 | imux->items[imux->num_items].index = |
| 3657 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3658 | imux->num_items++; |
| 3659 | } |
| 3660 | } |
| 3661 | return 0; |
| 3662 | } |
| 3663 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3664 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3665 | unsigned int pin_type) |
| 3666 | { |
| 3667 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3668 | pin_type); |
| 3669 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3670 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3671 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3672 | } |
| 3673 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3674 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3675 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3676 | int dac_idx) |
| 3677 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3678 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3679 | /* need the manual connection? */ |
| 3680 | if (alc880_is_multi_pin(nid)) { |
| 3681 | struct alc_spec *spec = codec->spec; |
| 3682 | int idx = alc880_multi_pin_idx(nid); |
| 3683 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3684 | AC_VERB_SET_CONNECT_SEL, |
| 3685 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3686 | } |
| 3687 | } |
| 3688 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3689 | static int get_pin_type(int line_out_type) |
| 3690 | { |
| 3691 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3692 | return PIN_HP; |
| 3693 | else |
| 3694 | return PIN_OUT; |
| 3695 | } |
| 3696 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3697 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3698 | { |
| 3699 | struct alc_spec *spec = codec->spec; |
| 3700 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3701 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3702 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3703 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3704 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3705 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3706 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3707 | } |
| 3708 | } |
| 3709 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3710 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3711 | { |
| 3712 | struct alc_spec *spec = codec->spec; |
| 3713 | hda_nid_t pin; |
| 3714 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3715 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3716 | if (pin) /* connect to front */ |
| 3717 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3718 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3719 | if (pin) /* connect to front */ |
| 3720 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3721 | } |
| 3722 | |
| 3723 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3724 | { |
| 3725 | struct alc_spec *spec = codec->spec; |
| 3726 | int i; |
| 3727 | |
| 3728 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3729 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3730 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3731 | snd_hda_codec_write(codec, nid, 0, |
| 3732 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3733 | i <= AUTO_PIN_FRONT_MIC ? |
| 3734 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3735 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3736 | snd_hda_codec_write(codec, nid, 0, |
| 3737 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3738 | AMP_OUT_MUTE); |
| 3739 | } |
| 3740 | } |
| 3741 | } |
| 3742 | |
| 3743 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3744 | /* return 1 if successful, 0 if the proper config is not found, |
| 3745 | * or a negative error code |
| 3746 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3747 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3748 | { |
| 3749 | struct alc_spec *spec = codec->spec; |
| 3750 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3751 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3752 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3753 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3754 | alc880_ignore); |
| 3755 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3756 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3757 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3758 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3759 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3760 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3761 | if (err < 0) |
| 3762 | return err; |
| 3763 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3764 | if (err < 0) |
| 3765 | return err; |
| 3766 | err = alc880_auto_create_extra_out(spec, |
| 3767 | spec->autocfg.speaker_pins[0], |
| 3768 | "Speaker"); |
| 3769 | if (err < 0) |
| 3770 | return err; |
| 3771 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3772 | "Headphone"); |
| 3773 | if (err < 0) |
| 3774 | return err; |
| 3775 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3776 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3777 | return err; |
| 3778 | |
| 3779 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3780 | |
| 3781 | if (spec->autocfg.dig_out_pin) |
| 3782 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3783 | if (spec->autocfg.dig_in_pin) |
| 3784 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3785 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 3786 | if (spec->kctls.list) |
| 3787 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3788 | |
| 3789 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3790 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3791 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3792 | spec->input_mux = &spec->private_imux; |
| 3793 | |
| 3794 | return 1; |
| 3795 | } |
| 3796 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3797 | /* additional initialization for auto-configuration model */ |
| 3798 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3799 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3800 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3801 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3802 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3803 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3804 | if (spec->unsol_event) |
| 3805 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3806 | } |
| 3807 | |
| 3808 | /* |
| 3809 | * OK, here we have finally the patch for ALC880 |
| 3810 | */ |
| 3811 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3812 | static int patch_alc880(struct hda_codec *codec) |
| 3813 | { |
| 3814 | struct alc_spec *spec; |
| 3815 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3816 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3817 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3818 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3819 | if (spec == NULL) |
| 3820 | return -ENOMEM; |
| 3821 | |
| 3822 | codec->spec = spec; |
| 3823 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3824 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3825 | alc880_models, |
| 3826 | alc880_cfg_tbl); |
| 3827 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3828 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3829 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3830 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3831 | } |
| 3832 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3833 | if (board_config == ALC880_AUTO) { |
| 3834 | /* automatic parse from the BIOS config */ |
| 3835 | err = alc880_parse_auto_config(codec); |
| 3836 | if (err < 0) { |
| 3837 | alc_free(codec); |
| 3838 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3839 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3840 | printk(KERN_INFO |
| 3841 | "hda_codec: Cannot set up configuration " |
| 3842 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3843 | board_config = ALC880_3ST; |
| 3844 | } |
| 3845 | } |
| 3846 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3847 | if (board_config != ALC880_AUTO) |
| 3848 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3849 | |
| 3850 | spec->stream_name_analog = "ALC880 Analog"; |
| 3851 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3852 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3853 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3854 | |
| 3855 | spec->stream_name_digital = "ALC880 Digital"; |
| 3856 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3857 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3858 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3859 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3860 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3861 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3862 | /* get type */ |
| 3863 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3864 | if (wcap != AC_WID_AUD_IN) { |
| 3865 | spec->adc_nids = alc880_adc_nids_alt; |
| 3866 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3867 | spec->mixers[spec->num_mixers] = |
| 3868 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3869 | spec->num_mixers++; |
| 3870 | } else { |
| 3871 | spec->adc_nids = alc880_adc_nids; |
| 3872 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3873 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3874 | spec->num_mixers++; |
| 3875 | } |
| 3876 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3877 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3878 | spec->vmaster_nid = 0x0c; |
| 3879 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3880 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3881 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3882 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3883 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3884 | if (!spec->loopback.amplist) |
| 3885 | spec->loopback.amplist = alc880_loopbacks; |
| 3886 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3887 | |
| 3888 | return 0; |
| 3889 | } |
| 3890 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3891 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3892 | /* |
| 3893 | * ALC260 support |
| 3894 | */ |
| 3895 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3896 | static hda_nid_t alc260_dac_nids[1] = { |
| 3897 | /* front */ |
| 3898 | 0x02, |
| 3899 | }; |
| 3900 | |
| 3901 | static hda_nid_t alc260_adc_nids[1] = { |
| 3902 | /* ADC0 */ |
| 3903 | 0x04, |
| 3904 | }; |
| 3905 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3906 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3907 | /* ADC1 */ |
| 3908 | 0x05, |
| 3909 | }; |
| 3910 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3911 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3912 | /* ADC1, 0 */ |
| 3913 | 0x05, 0x04 |
| 3914 | }; |
| 3915 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3916 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3917 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3918 | */ |
| 3919 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3920 | /* ADC0, ADC1 */ |
| 3921 | 0x04, 0x05 |
| 3922 | }; |
| 3923 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3924 | #define ALC260_DIGOUT_NID 0x03 |
| 3925 | #define ALC260_DIGIN_NID 0x06 |
| 3926 | |
| 3927 | static struct hda_input_mux alc260_capture_source = { |
| 3928 | .num_items = 4, |
| 3929 | .items = { |
| 3930 | { "Mic", 0x0 }, |
| 3931 | { "Front Mic", 0x1 }, |
| 3932 | { "Line", 0x2 }, |
| 3933 | { "CD", 0x4 }, |
| 3934 | }, |
| 3935 | }; |
| 3936 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3937 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3938 | * headphone jack and the internal CD lines since these are the only pins at |
| 3939 | * which audio can appear. For flexibility, also allow the option of |
| 3940 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3941 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3942 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3943 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3944 | { |
| 3945 | .num_items = 3, |
| 3946 | .items = { |
| 3947 | { "Mic/Line", 0x0 }, |
| 3948 | { "CD", 0x4 }, |
| 3949 | { "Headphone", 0x2 }, |
| 3950 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3951 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3952 | { |
| 3953 | .num_items = 4, |
| 3954 | .items = { |
| 3955 | { "Mic/Line", 0x0 }, |
| 3956 | { "CD", 0x4 }, |
| 3957 | { "Headphone", 0x2 }, |
| 3958 | { "Mixer", 0x5 }, |
| 3959 | }, |
| 3960 | }, |
| 3961 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3962 | }; |
| 3963 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3964 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3965 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3966 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3967 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3968 | { |
| 3969 | .num_items = 4, |
| 3970 | .items = { |
| 3971 | { "Mic", 0x0 }, |
| 3972 | { "Line", 0x2 }, |
| 3973 | { "CD", 0x4 }, |
| 3974 | { "Headphone", 0x5 }, |
| 3975 | }, |
| 3976 | }, |
| 3977 | { |
| 3978 | .num_items = 5, |
| 3979 | .items = { |
| 3980 | { "Mic", 0x0 }, |
| 3981 | { "Line", 0x2 }, |
| 3982 | { "CD", 0x4 }, |
| 3983 | { "Headphone", 0x6 }, |
| 3984 | { "Mixer", 0x5 }, |
| 3985 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3986 | }, |
| 3987 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3988 | /* |
| 3989 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3990 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3991 | * element which allows changing the channel mode, so the verb list is |
| 3992 | * never used. |
| 3993 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3994 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3995 | { 2, NULL }, |
| 3996 | }; |
| 3997 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3998 | |
| 3999 | /* Mixer combinations |
| 4000 | * |
| 4001 | * basic: base_output + input + pc_beep + capture |
| 4002 | * HP: base_output + input + capture_alt |
| 4003 | * HP_3013: hp_3013 + input + capture |
| 4004 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4005 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4006 | */ |
| 4007 | |
| 4008 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4009 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4010 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4011 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4012 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4013 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4014 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4015 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4016 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4017 | |
| 4018 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4019 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4020 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4021 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4022 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4023 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4024 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4025 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4026 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4027 | { } /* end */ |
| 4028 | }; |
| 4029 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4030 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 4031 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4032 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4033 | { } /* end */ |
| 4034 | }; |
| 4035 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4036 | /* update HP, line and mono out pins according to the master switch */ |
| 4037 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4038 | hda_nid_t hp, hda_nid_t line, |
| 4039 | hda_nid_t mono) |
| 4040 | { |
| 4041 | struct alc_spec *spec = codec->spec; |
| 4042 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4043 | /* change HP and line-out pins */ |
| 4044 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4045 | val); |
| 4046 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4047 | val); |
| 4048 | /* mono (speaker) depending on the HP jack sense */ |
| 4049 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 4050 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4051 | val); |
| 4052 | } |
| 4053 | |
| 4054 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4055 | struct snd_ctl_elem_value *ucontrol) |
| 4056 | { |
| 4057 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4058 | struct alc_spec *spec = codec->spec; |
| 4059 | *ucontrol->value.integer.value = spec->master_sw; |
| 4060 | return 0; |
| 4061 | } |
| 4062 | |
| 4063 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4064 | struct snd_ctl_elem_value *ucontrol) |
| 4065 | { |
| 4066 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4067 | struct alc_spec *spec = codec->spec; |
| 4068 | int val = !!*ucontrol->value.integer.value; |
| 4069 | hda_nid_t hp, line, mono; |
| 4070 | |
| 4071 | if (val == spec->master_sw) |
| 4072 | return 0; |
| 4073 | spec->master_sw = val; |
| 4074 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4075 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4076 | mono = kcontrol->private_value & 0xff; |
| 4077 | alc260_hp_master_update(codec, hp, line, mono); |
| 4078 | return 1; |
| 4079 | } |
| 4080 | |
| 4081 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4082 | { |
| 4083 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4084 | .name = "Master Playback Switch", |
| 4085 | .info = snd_ctl_boolean_mono_info, |
| 4086 | .get = alc260_hp_master_sw_get, |
| 4087 | .put = alc260_hp_master_sw_put, |
| 4088 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4089 | }, |
| 4090 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4091 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4092 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4093 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4094 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4095 | HDA_OUTPUT), |
| 4096 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4097 | { } /* end */ |
| 4098 | }; |
| 4099 | |
| 4100 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4101 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4102 | {}, |
| 4103 | }; |
| 4104 | |
| 4105 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4106 | { |
| 4107 | struct alc_spec *spec = codec->spec; |
| 4108 | unsigned int present; |
| 4109 | |
| 4110 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4111 | AC_VERB_GET_PIN_SENSE, 0); |
| 4112 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4113 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4114 | } |
| 4115 | |
| 4116 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4117 | { |
| 4118 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4119 | alc260_hp_automute(codec); |
| 4120 | } |
| 4121 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4122 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4123 | { |
| 4124 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4125 | .name = "Master Playback Switch", |
| 4126 | .info = snd_ctl_boolean_mono_info, |
| 4127 | .get = alc260_hp_master_sw_get, |
| 4128 | .put = alc260_hp_master_sw_put, |
| 4129 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 4130 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4131 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4132 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4133 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4134 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4135 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4136 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4137 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4138 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4139 | { } /* end */ |
| 4140 | }; |
| 4141 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4142 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4143 | .ops = &snd_hda_bind_vol, |
| 4144 | .values = { |
| 4145 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4146 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4147 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4148 | 0 |
| 4149 | }, |
| 4150 | }; |
| 4151 | |
| 4152 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4153 | .ops = &snd_hda_bind_sw, |
| 4154 | .values = { |
| 4155 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4156 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4157 | 0 |
| 4158 | }, |
| 4159 | }; |
| 4160 | |
| 4161 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4162 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4163 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4164 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4165 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4166 | { } /* end */ |
| 4167 | }; |
| 4168 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4169 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4170 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4171 | {}, |
| 4172 | }; |
| 4173 | |
| 4174 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4175 | { |
| 4176 | struct alc_spec *spec = codec->spec; |
| 4177 | unsigned int present; |
| 4178 | |
| 4179 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4180 | AC_VERB_GET_PIN_SENSE, 0); |
| 4181 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4182 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 4183 | } |
| 4184 | |
| 4185 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4186 | unsigned int res) |
| 4187 | { |
| 4188 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4189 | alc260_hp_3013_automute(codec); |
| 4190 | } |
| 4191 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4192 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4193 | { |
| 4194 | unsigned int present, bits; |
| 4195 | |
| 4196 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4197 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4198 | |
| 4199 | bits = present ? 0 : PIN_OUT; |
| 4200 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4201 | bits); |
| 4202 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4203 | bits); |
| 4204 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4205 | bits); |
| 4206 | } |
| 4207 | |
| 4208 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4209 | unsigned int res) |
| 4210 | { |
| 4211 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4212 | alc260_hp_3012_automute(codec); |
| 4213 | } |
| 4214 | |
| 4215 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4216 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4217 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4218 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4219 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4220 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4221 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4222 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4223 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4224 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4225 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4226 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4227 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4228 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4229 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4230 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4231 | { } /* end */ |
| 4232 | }; |
| 4233 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4234 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4235 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4236 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4237 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4238 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4239 | * revisions available in early 2006. Therefore for now allow the |
| 4240 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4241 | * that the lack of mic bias for this NID is intentional we could change the |
| 4242 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4243 | * |
| 4244 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4245 | * don't appear to make the mic bias available from the "line" jack, even |
| 4246 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4247 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4248 | * and the output jack. If this turns out to be the case for all such |
| 4249 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4250 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4251 | * |
| 4252 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4253 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4254 | * controls for such models. On models without a "mono speaker" the control |
| 4255 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4256 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4257 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4258 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4259 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4260 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4261 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4262 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4263 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4264 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4265 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4266 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4267 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4268 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4269 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4270 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4271 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4272 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4273 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4274 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4275 | { } /* end */ |
| 4276 | }; |
| 4277 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4278 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4279 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4280 | */ |
| 4281 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4282 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4283 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4284 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4285 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4286 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4287 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4288 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4289 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4290 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4291 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4292 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4293 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4294 | { } /* end */ |
| 4295 | }; |
| 4296 | |
| 4297 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4298 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4299 | */ |
| 4300 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4301 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4302 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4303 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4304 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4305 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4306 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4307 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4308 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4309 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4310 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4311 | { } /* end */ |
| 4312 | }; |
| 4313 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4314 | /* capture mixer elements */ |
| 4315 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4316 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4317 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4318 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4319 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4320 | { |
| 4321 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4322 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4323 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4324 | */ |
| 4325 | /* .name = "Capture Source", */ |
| 4326 | .name = "Input Source", |
| 4327 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4328 | .info = alc_mux_enum_info, |
| 4329 | .get = alc_mux_enum_get, |
| 4330 | .put = alc_mux_enum_put, |
| 4331 | }, |
| 4332 | { } /* end */ |
| 4333 | }; |
| 4334 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4335 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4336 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4337 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4338 | { |
| 4339 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4340 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4341 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4342 | */ |
| 4343 | /* .name = "Capture Source", */ |
| 4344 | .name = "Input Source", |
| 4345 | .count = 1, |
| 4346 | .info = alc_mux_enum_info, |
| 4347 | .get = alc_mux_enum_get, |
| 4348 | .put = alc_mux_enum_put, |
| 4349 | }, |
| 4350 | { } /* end */ |
| 4351 | }; |
| 4352 | |
| 4353 | /* |
| 4354 | * initialization verbs |
| 4355 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4356 | static struct hda_verb alc260_init_verbs[] = { |
| 4357 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4358 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4359 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4360 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4361 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4362 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4363 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4364 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4365 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4366 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4367 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4368 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4369 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4370 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4371 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4372 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4373 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4374 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4375 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4376 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4377 | /* set connection select to line in (default select for this ADC) */ |
| 4378 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4379 | /* mute capture amp left and right */ |
| 4380 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4381 | /* set connection select to line in (default select for this ADC) */ |
| 4382 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4383 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4384 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4385 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4386 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4387 | /* set vol=0 HP mixer amp left and right */ |
| 4388 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4389 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4390 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4391 | /* set vol=0 Mono mixer amp left and right */ |
| 4392 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4393 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4394 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4395 | /* unmute LINE-2 out pin */ |
| 4396 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4397 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4398 | * Line In 2 = 0x03 |
| 4399 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4400 | /* mute analog inputs */ |
| 4401 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4402 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4403 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4404 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4405 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4406 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4407 | /* mute Front out path */ |
| 4408 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4409 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4410 | /* mute Headphone out path */ |
| 4411 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4412 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4413 | /* mute Mono out path */ |
| 4414 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4415 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4416 | { } |
| 4417 | }; |
| 4418 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4419 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4420 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4421 | /* Headphone and output */ |
| 4422 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4423 | /* mono output */ |
| 4424 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4425 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4426 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4427 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4428 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4429 | /* Line In pin widget for input */ |
| 4430 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4431 | /* Line-2 pin widget for output */ |
| 4432 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4433 | /* CD pin widget for input */ |
| 4434 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4435 | /* unmute amp left and right */ |
| 4436 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4437 | /* set connection select to line in (default select for this ADC) */ |
| 4438 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4439 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4440 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4441 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4442 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4443 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4444 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4445 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4446 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4447 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4448 | * Line In 2 = 0x03 |
| 4449 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4450 | /* mute analog inputs */ |
| 4451 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4452 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4453 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4454 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4455 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4456 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4457 | /* Unmute Front out path */ |
| 4458 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4459 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4460 | /* Unmute Headphone out path */ |
| 4461 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4462 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4463 | /* Unmute Mono out path */ |
| 4464 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4465 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4466 | { } |
| 4467 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4468 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4469 | |
| 4470 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4471 | /* Line out and output */ |
| 4472 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4473 | /* mono output */ |
| 4474 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4475 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4476 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4477 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4478 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4479 | /* Line In pin widget for input */ |
| 4480 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4481 | /* Headphone pin widget for output */ |
| 4482 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4483 | /* CD pin widget for input */ |
| 4484 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4485 | /* unmute amp left and right */ |
| 4486 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4487 | /* set connection select to line in (default select for this ADC) */ |
| 4488 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4489 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4490 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4491 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4492 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4493 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4494 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4495 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4496 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4497 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4498 | * Line In 2 = 0x03 |
| 4499 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4500 | /* mute analog inputs */ |
| 4501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4502 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4505 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4506 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4507 | /* Unmute Front out path */ |
| 4508 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4509 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4510 | /* Unmute Headphone out path */ |
| 4511 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4512 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4513 | /* Unmute Mono out path */ |
| 4514 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4515 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4516 | { } |
| 4517 | }; |
| 4518 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4519 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4520 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4521 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4522 | */ |
| 4523 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4524 | /* Disable all GPIOs */ |
| 4525 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4526 | /* Internal speaker is connected to headphone pin */ |
| 4527 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4528 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4529 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4530 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4531 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4532 | /* Ensure all other unused pins are disabled and muted. */ |
| 4533 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4534 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4535 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4536 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4537 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4538 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4539 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4540 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4541 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4542 | /* Disable digital (SPDIF) pins */ |
| 4543 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4544 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4545 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4546 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4547 | * when acting as an output. |
| 4548 | */ |
| 4549 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4550 | |
| 4551 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4552 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4553 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4554 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4555 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4556 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4557 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4558 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4559 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4560 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4561 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4562 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4563 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4564 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4565 | * If the pin mode is changed by the user the pin mode control will |
| 4566 | * take care of enabling the pin's input/output buffers as needed. |
| 4567 | * Therefore there's no need to enable the input buffer at this |
| 4568 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4569 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4570 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4571 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4572 | * mixer ctrl) |
| 4573 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4574 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4575 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4576 | /* Mute capture amp left and right */ |
| 4577 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4578 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4579 | * in (on mic1 pin) |
| 4580 | */ |
| 4581 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4582 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4583 | /* Do the same for the second ADC: mute capture input amp and |
| 4584 | * set ADC connection to line in (on mic1 pin) |
| 4585 | */ |
| 4586 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4587 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4588 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4589 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4590 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4591 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4592 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4593 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4594 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4595 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4596 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4597 | {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] | 4598 | |
| 4599 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4600 | }; |
| 4601 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4602 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4603 | * similar laptops (adapted from Fujitsu init verbs). |
| 4604 | */ |
| 4605 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4606 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4607 | * the headphone jack. Turn this on and rely on the standard mute |
| 4608 | * methods whenever the user wants to turn these outputs off. |
| 4609 | */ |
| 4610 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4611 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4612 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4613 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4614 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4615 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4616 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4617 | /* Line In jack is connected to Line1 pin */ |
| 4618 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4619 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4620 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4621 | /* Ensure all other unused pins are disabled and muted. */ |
| 4622 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4623 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4624 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4625 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4626 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4627 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4628 | /* Disable digital (SPDIF) pins */ |
| 4629 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4630 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4631 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4632 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4633 | * bus when acting as outputs. |
| 4634 | */ |
| 4635 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4636 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4637 | |
| 4638 | /* Start with output sum widgets muted and their output gains at min */ |
| 4639 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4640 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4641 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4642 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4643 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4644 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4645 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4646 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4647 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4648 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4649 | /* Unmute Line-out pin widget amp left and right |
| 4650 | * (no equiv mixer ctrl) |
| 4651 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4652 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4653 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4654 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4655 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4656 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4657 | * will take care of enabling the pin's input/output buffers as needed. |
| 4658 | * Therefore there's no need to enable the input buffer at this |
| 4659 | * stage. |
| 4660 | */ |
| 4661 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4662 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4663 | |
| 4664 | /* Mute capture amp left and right */ |
| 4665 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4666 | /* Set ADC connection select to match default mixer setting - mic |
| 4667 | * (on mic1 pin) |
| 4668 | */ |
| 4669 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4670 | |
| 4671 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4672 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4673 | */ |
| 4674 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4675 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4676 | |
| 4677 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4678 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4679 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4680 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4681 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4682 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4683 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4684 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4685 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4686 | |
| 4687 | { } |
| 4688 | }; |
| 4689 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4690 | static struct hda_verb alc260_will_verbs[] = { |
| 4691 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4692 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4693 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4694 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4695 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4696 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4697 | {} |
| 4698 | }; |
| 4699 | |
| 4700 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4701 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4702 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4703 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4704 | |
| 4705 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4706 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4707 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4708 | |
| 4709 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4710 | {} |
| 4711 | }; |
| 4712 | |
| 4713 | /* toggle speaker-output according to the hp-jack state */ |
| 4714 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4715 | { |
| 4716 | unsigned int present; |
| 4717 | |
| 4718 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4719 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4720 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4721 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4722 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4723 | AC_VERB_SET_GPIO_DATA, 1); |
| 4724 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4725 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4726 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4727 | } else { |
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, 0); |
| 4730 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4731 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4732 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4733 | } |
| 4734 | } |
| 4735 | |
| 4736 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4737 | unsigned int res) |
| 4738 | { |
| 4739 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4740 | alc260_replacer_672v_automute(codec); |
| 4741 | } |
| 4742 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4743 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 4744 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4745 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4746 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4747 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4748 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4749 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4750 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4751 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4752 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4753 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4754 | {} |
| 4755 | }; |
| 4756 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4757 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4758 | * configuration. |
| 4759 | */ |
| 4760 | #ifdef CONFIG_SND_DEBUG |
| 4761 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4762 | 0x02, |
| 4763 | }; |
| 4764 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4765 | 0x04, 0x05, |
| 4766 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4767 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4768 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4769 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4770 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4771 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4772 | { |
| 4773 | .num_items = 7, |
| 4774 | .items = { |
| 4775 | { "MIC1 pin", 0x0 }, |
| 4776 | { "MIC2 pin", 0x1 }, |
| 4777 | { "LINE1 pin", 0x2 }, |
| 4778 | { "LINE2 pin", 0x3 }, |
| 4779 | { "CD pin", 0x4 }, |
| 4780 | { "LINE-OUT pin", 0x5 }, |
| 4781 | { "HP-OUT pin", 0x6 }, |
| 4782 | }, |
| 4783 | }, |
| 4784 | { |
| 4785 | .num_items = 8, |
| 4786 | .items = { |
| 4787 | { "MIC1 pin", 0x0 }, |
| 4788 | { "MIC2 pin", 0x1 }, |
| 4789 | { "LINE1 pin", 0x2 }, |
| 4790 | { "LINE2 pin", 0x3 }, |
| 4791 | { "CD pin", 0x4 }, |
| 4792 | { "Mixer", 0x5 }, |
| 4793 | { "LINE-OUT pin", 0x6 }, |
| 4794 | { "HP-OUT pin", 0x7 }, |
| 4795 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4796 | }, |
| 4797 | }; |
| 4798 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4799 | /* Output driver widgets */ |
| 4800 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4801 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4802 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4803 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4804 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4805 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4806 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4807 | /* Modes for retasking pin widgets |
| 4808 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4809 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4810 | * mention this restriction. At this stage it's not clear whether |
| 4811 | * this behaviour is intentional or is a hardware bug in chip |
| 4812 | * revisions available at least up until early 2006. Therefore for |
| 4813 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4814 | * choices, but if it turns out that the lack of mic bias for these |
| 4815 | * NIDs is intentional we could change their modes from |
| 4816 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4817 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4818 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4819 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4820 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4821 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4822 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4823 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4824 | |
| 4825 | /* Loopback mixer controls */ |
| 4826 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4827 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4828 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4829 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4830 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4831 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4832 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4833 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4834 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4835 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4836 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4837 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4838 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4839 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4840 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4841 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4842 | |
| 4843 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4844 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4845 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4846 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4847 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4848 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4849 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4850 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4851 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4852 | */ |
| 4853 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4854 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4855 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4856 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4857 | * this output to turn on an external amplifier. |
| 4858 | */ |
| 4859 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4860 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4861 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4862 | { } /* end */ |
| 4863 | }; |
| 4864 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4865 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4866 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4867 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4868 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4869 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4870 | /* Enable retasking pins as output, initially without power amp */ |
| 4871 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4872 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4873 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4874 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4875 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4876 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4877 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4878 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4879 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4880 | * payload also sets the generation to 0, output to be in "consumer" |
| 4881 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4882 | * control. |
| 4883 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4884 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4885 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4886 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4887 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4888 | * OUT1 sum bus when acting as an output. |
| 4889 | */ |
| 4890 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4891 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4892 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4893 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4894 | |
| 4895 | /* Start with output sum widgets muted and their output gains at min */ |
| 4896 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4897 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4898 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4899 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4900 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4901 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4902 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4903 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4904 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4905 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4906 | /* Unmute retasking pin widget output buffers since the default |
| 4907 | * state appears to be output. As the pin mode is changed by the |
| 4908 | * user the pin mode control will take care of enabling the pin's |
| 4909 | * input/output buffers as needed. |
| 4910 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4911 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4912 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4913 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4914 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4915 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4916 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4917 | /* Also unmute the mono-out pin widget */ |
| 4918 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4919 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4920 | /* Mute capture amp left and right */ |
| 4921 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4922 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4923 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4924 | */ |
| 4925 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4926 | |
| 4927 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4928 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4929 | */ |
| 4930 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4931 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4932 | |
| 4933 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4934 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4935 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4936 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4937 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4938 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4939 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4940 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4941 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4942 | |
| 4943 | { } |
| 4944 | }; |
| 4945 | #endif |
| 4946 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4947 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4948 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4949 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4950 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4951 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4952 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4953 | /* |
| 4954 | * for BIOS auto-configuration |
| 4955 | */ |
| 4956 | |
| 4957 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4958 | const char *pfx) |
| 4959 | { |
| 4960 | hda_nid_t nid_vol; |
| 4961 | unsigned long vol_val, sw_val; |
| 4962 | char name[32]; |
| 4963 | int err; |
| 4964 | |
| 4965 | if (nid >= 0x0f && nid < 0x11) { |
| 4966 | nid_vol = nid - 0x7; |
| 4967 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4968 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4969 | } else if (nid == 0x11) { |
| 4970 | nid_vol = nid - 0x7; |
| 4971 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4972 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4973 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4974 | nid_vol = 0x08; |
| 4975 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4976 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4977 | } else |
| 4978 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4979 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4980 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4981 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4982 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4983 | return err; |
| 4984 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4985 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4986 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4987 | return err; |
| 4988 | return 1; |
| 4989 | } |
| 4990 | |
| 4991 | /* add playback controls from the parsed DAC table */ |
| 4992 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4993 | const struct auto_pin_cfg *cfg) |
| 4994 | { |
| 4995 | hda_nid_t nid; |
| 4996 | int err; |
| 4997 | |
| 4998 | spec->multiout.num_dacs = 1; |
| 4999 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5000 | spec->multiout.dac_nids[0] = 0x02; |
| 5001 | |
| 5002 | nid = cfg->line_out_pins[0]; |
| 5003 | if (nid) { |
| 5004 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 5005 | if (err < 0) |
| 5006 | return err; |
| 5007 | } |
| 5008 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5009 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5010 | if (nid) { |
| 5011 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 5012 | if (err < 0) |
| 5013 | return err; |
| 5014 | } |
| 5015 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5016 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5017 | if (nid) { |
| 5018 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 5019 | if (err < 0) |
| 5020 | return err; |
| 5021 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5022 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5023 | } |
| 5024 | |
| 5025 | /* create playback/capture controls for input pins */ |
| 5026 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5027 | const struct auto_pin_cfg *cfg) |
| 5028 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5029 | struct hda_input_mux *imux = &spec->private_imux; |
| 5030 | int i, err, idx; |
| 5031 | |
| 5032 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5033 | if (cfg->input_pins[i] >= 0x12) { |
| 5034 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5035 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5036 | auto_pin_cfg_labels[i], idx, |
| 5037 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5038 | if (err < 0) |
| 5039 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5040 | imux->items[imux->num_items].label = |
| 5041 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5042 | imux->items[imux->num_items].index = idx; |
| 5043 | imux->num_items++; |
| 5044 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5045 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5046 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5047 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5048 | auto_pin_cfg_labels[i], idx, |
| 5049 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5050 | if (err < 0) |
| 5051 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5052 | imux->items[imux->num_items].label = |
| 5053 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5054 | imux->items[imux->num_items].index = idx; |
| 5055 | imux->num_items++; |
| 5056 | } |
| 5057 | } |
| 5058 | return 0; |
| 5059 | } |
| 5060 | |
| 5061 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5062 | hda_nid_t nid, int pin_type, |
| 5063 | int sel_idx) |
| 5064 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5065 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5066 | /* need the manual connection? */ |
| 5067 | if (nid >= 0x12) { |
| 5068 | int idx = nid - 0x12; |
| 5069 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5070 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5071 | } |
| 5072 | } |
| 5073 | |
| 5074 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5075 | { |
| 5076 | struct alc_spec *spec = codec->spec; |
| 5077 | hda_nid_t nid; |
| 5078 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5079 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5080 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5081 | if (nid) { |
| 5082 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5083 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5084 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5085 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5086 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5087 | if (nid) |
| 5088 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5089 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5090 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5091 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5092 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5093 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5094 | |
| 5095 | #define ALC260_PIN_CD_NID 0x16 |
| 5096 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5097 | { |
| 5098 | struct alc_spec *spec = codec->spec; |
| 5099 | int i; |
| 5100 | |
| 5101 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5102 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5103 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5104 | snd_hda_codec_write(codec, nid, 0, |
| 5105 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5106 | i <= AUTO_PIN_FRONT_MIC ? |
| 5107 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5108 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5109 | snd_hda_codec_write(codec, nid, 0, |
| 5110 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5111 | AMP_OUT_MUTE); |
| 5112 | } |
| 5113 | } |
| 5114 | } |
| 5115 | |
| 5116 | /* |
| 5117 | * generic initialization of ADC, input mixers and output mixers |
| 5118 | */ |
| 5119 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5120 | /* |
| 5121 | * Unmute ADC0-1 and set the default input to mic-in |
| 5122 | */ |
| 5123 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5124 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5125 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5126 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5127 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5128 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5129 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5130 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5131 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5132 | */ |
| 5133 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5134 | /* mute analog inputs */ |
| 5135 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5136 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5137 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5138 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5139 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5140 | |
| 5141 | /* |
| 5142 | * Set up output mixers (0x08 - 0x0a) |
| 5143 | */ |
| 5144 | /* set vol=0 to output mixers */ |
| 5145 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5146 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5147 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5148 | /* set up input amps for analog loopback */ |
| 5149 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5150 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5151 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5152 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5153 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5154 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5155 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5156 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5157 | { } |
| 5158 | }; |
| 5159 | |
| 5160 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5161 | { |
| 5162 | struct alc_spec *spec = codec->spec; |
| 5163 | unsigned int wcap; |
| 5164 | int err; |
| 5165 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5166 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5167 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5168 | alc260_ignore); |
| 5169 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5170 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5171 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5172 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5173 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 5174 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5175 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5176 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5177 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5178 | return err; |
| 5179 | |
| 5180 | spec->multiout.max_channels = 2; |
| 5181 | |
| 5182 | if (spec->autocfg.dig_out_pin) |
| 5183 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 5184 | if (spec->kctls.list) |
| 5185 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5186 | |
| 5187 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 5188 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5189 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5190 | spec->input_mux = &spec->private_imux; |
| 5191 | |
| 5192 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5193 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5194 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 5195 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5196 | spec->adc_nids = alc260_adc_nids_alt; |
| 5197 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5198 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5199 | } else { |
| 5200 | spec->adc_nids = alc260_adc_nids; |
| 5201 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5202 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5203 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5204 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5205 | |
| 5206 | return 1; |
| 5207 | } |
| 5208 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5209 | /* additional initialization for auto-configuration model */ |
| 5210 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5211 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5212 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5213 | alc260_auto_init_multi_out(codec); |
| 5214 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5215 | if (spec->unsol_event) |
| 5216 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5217 | } |
| 5218 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5219 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5220 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5221 | { 0x07, HDA_INPUT, 0 }, |
| 5222 | { 0x07, HDA_INPUT, 1 }, |
| 5223 | { 0x07, HDA_INPUT, 2 }, |
| 5224 | { 0x07, HDA_INPUT, 3 }, |
| 5225 | { 0x07, HDA_INPUT, 4 }, |
| 5226 | { } /* end */ |
| 5227 | }; |
| 5228 | #endif |
| 5229 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5230 | /* |
| 5231 | * ALC260 configurations |
| 5232 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5233 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5234 | [ALC260_BASIC] = "basic", |
| 5235 | [ALC260_HP] = "hp", |
| 5236 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5237 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5238 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5239 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5240 | [ALC260_WILL] = "will", |
| 5241 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5242 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5243 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5244 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5245 | [ALC260_AUTO] = "auto", |
| 5246 | }; |
| 5247 | |
| 5248 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5249 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5250 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5251 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5252 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5253 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5254 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5255 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5256 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5257 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5258 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5259 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5260 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5261 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5262 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5263 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5264 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5265 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5266 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5267 | {} |
| 5268 | }; |
| 5269 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5270 | static struct alc_config_preset alc260_presets[] = { |
| 5271 | [ALC260_BASIC] = { |
| 5272 | .mixers = { alc260_base_output_mixer, |
| 5273 | alc260_input_mixer, |
| 5274 | alc260_pc_beep_mixer, |
| 5275 | alc260_capture_mixer }, |
| 5276 | .init_verbs = { alc260_init_verbs }, |
| 5277 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5278 | .dac_nids = alc260_dac_nids, |
| 5279 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5280 | .adc_nids = alc260_adc_nids, |
| 5281 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5282 | .channel_mode = alc260_modes, |
| 5283 | .input_mux = &alc260_capture_source, |
| 5284 | }, |
| 5285 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5286 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5287 | alc260_input_mixer, |
| 5288 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5289 | .init_verbs = { alc260_init_verbs, |
| 5290 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5291 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5292 | .dac_nids = alc260_dac_nids, |
| 5293 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5294 | .adc_nids = alc260_hp_adc_nids, |
| 5295 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5296 | .channel_mode = alc260_modes, |
| 5297 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5298 | .unsol_event = alc260_hp_unsol_event, |
| 5299 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5300 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5301 | [ALC260_HP_DC7600] = { |
| 5302 | .mixers = { alc260_hp_dc7600_mixer, |
| 5303 | alc260_input_mixer, |
| 5304 | alc260_capture_alt_mixer }, |
| 5305 | .init_verbs = { alc260_init_verbs, |
| 5306 | alc260_hp_dc7600_verbs }, |
| 5307 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5308 | .dac_nids = alc260_dac_nids, |
| 5309 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5310 | .adc_nids = alc260_hp_adc_nids, |
| 5311 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5312 | .channel_mode = alc260_modes, |
| 5313 | .input_mux = &alc260_capture_source, |
| 5314 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5315 | .init_hook = alc260_hp_3012_automute, |
| 5316 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5317 | [ALC260_HP_3013] = { |
| 5318 | .mixers = { alc260_hp_3013_mixer, |
| 5319 | alc260_input_mixer, |
| 5320 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5321 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5322 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5323 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5324 | .dac_nids = alc260_dac_nids, |
| 5325 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5326 | .adc_nids = alc260_hp_adc_nids, |
| 5327 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5328 | .channel_mode = alc260_modes, |
| 5329 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5330 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5331 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5332 | }, |
| 5333 | [ALC260_FUJITSU_S702X] = { |
| 5334 | .mixers = { alc260_fujitsu_mixer, |
| 5335 | alc260_capture_mixer }, |
| 5336 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5337 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5338 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5339 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5340 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5341 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5342 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5343 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5344 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5345 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5346 | [ALC260_ACER] = { |
| 5347 | .mixers = { alc260_acer_mixer, |
| 5348 | alc260_capture_mixer }, |
| 5349 | .init_verbs = { alc260_acer_init_verbs }, |
| 5350 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5351 | .dac_nids = alc260_dac_nids, |
| 5352 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5353 | .adc_nids = alc260_dual_adc_nids, |
| 5354 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5355 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5356 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5357 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5358 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5359 | [ALC260_WILL] = { |
| 5360 | .mixers = { alc260_will_mixer, |
| 5361 | alc260_capture_mixer }, |
| 5362 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5363 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5364 | .dac_nids = alc260_dac_nids, |
| 5365 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5366 | .adc_nids = alc260_adc_nids, |
| 5367 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5368 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5369 | .channel_mode = alc260_modes, |
| 5370 | .input_mux = &alc260_capture_source, |
| 5371 | }, |
| 5372 | [ALC260_REPLACER_672V] = { |
| 5373 | .mixers = { alc260_replacer_672v_mixer, |
| 5374 | alc260_capture_mixer }, |
| 5375 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5376 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5377 | .dac_nids = alc260_dac_nids, |
| 5378 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5379 | .adc_nids = alc260_adc_nids, |
| 5380 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5381 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5382 | .channel_mode = alc260_modes, |
| 5383 | .input_mux = &alc260_capture_source, |
| 5384 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5385 | .init_hook = alc260_replacer_672v_automute, |
| 5386 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5387 | #ifdef CONFIG_SND_DEBUG |
| 5388 | [ALC260_TEST] = { |
| 5389 | .mixers = { alc260_test_mixer, |
| 5390 | alc260_capture_mixer }, |
| 5391 | .init_verbs = { alc260_test_init_verbs }, |
| 5392 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5393 | .dac_nids = alc260_test_dac_nids, |
| 5394 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5395 | .adc_nids = alc260_test_adc_nids, |
| 5396 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5397 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5398 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5399 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5400 | }, |
| 5401 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5402 | }; |
| 5403 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5404 | static int patch_alc260(struct hda_codec *codec) |
| 5405 | { |
| 5406 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5407 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5408 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5409 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5410 | if (spec == NULL) |
| 5411 | return -ENOMEM; |
| 5412 | |
| 5413 | codec->spec = spec; |
| 5414 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5415 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5416 | alc260_models, |
| 5417 | alc260_cfg_tbl); |
| 5418 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5419 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5420 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5421 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5422 | } |
| 5423 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5424 | if (board_config == ALC260_AUTO) { |
| 5425 | /* automatic parse from the BIOS config */ |
| 5426 | err = alc260_parse_auto_config(codec); |
| 5427 | if (err < 0) { |
| 5428 | alc_free(codec); |
| 5429 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5430 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5431 | printk(KERN_INFO |
| 5432 | "hda_codec: Cannot set up configuration " |
| 5433 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5434 | board_config = ALC260_BASIC; |
| 5435 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5436 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5437 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5438 | if (board_config != ALC260_AUTO) |
| 5439 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5440 | |
| 5441 | spec->stream_name_analog = "ALC260 Analog"; |
| 5442 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5443 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5444 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5445 | spec->stream_name_digital = "ALC260 Digital"; |
| 5446 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5447 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5448 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5449 | spec->vmaster_nid = 0x08; |
| 5450 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5451 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5452 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5453 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5454 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5455 | if (!spec->loopback.amplist) |
| 5456 | spec->loopback.amplist = alc260_loopbacks; |
| 5457 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5458 | |
| 5459 | return 0; |
| 5460 | } |
| 5461 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5462 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5463 | /* |
| 5464 | * ALC882 support |
| 5465 | * |
| 5466 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5467 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5468 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5469 | * 6-channel independent captures. |
| 5470 | * |
| 5471 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5472 | * driver yet). |
| 5473 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5474 | #define ALC882_DIGOUT_NID 0x06 |
| 5475 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5476 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5477 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5478 | { 8, NULL } |
| 5479 | }; |
| 5480 | |
| 5481 | static hda_nid_t alc882_dac_nids[4] = { |
| 5482 | /* front, rear, clfe, rear_surr */ |
| 5483 | 0x02, 0x03, 0x04, 0x05 |
| 5484 | }; |
| 5485 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5486 | /* identical with ALC880 */ |
| 5487 | #define alc882_adc_nids alc880_adc_nids |
| 5488 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5489 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5490 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5491 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5492 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5493 | /* input MUX */ |
| 5494 | /* FIXME: should be a matrix-type input source selection */ |
| 5495 | |
| 5496 | static struct hda_input_mux alc882_capture_source = { |
| 5497 | .num_items = 4, |
| 5498 | .items = { |
| 5499 | { "Mic", 0x0 }, |
| 5500 | { "Front Mic", 0x1 }, |
| 5501 | { "Line", 0x2 }, |
| 5502 | { "CD", 0x4 }, |
| 5503 | }, |
| 5504 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5505 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5506 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5507 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5508 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5509 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5510 | { |
| 5511 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5512 | struct alc_spec *spec = codec->spec; |
| 5513 | const struct hda_input_mux *imux = spec->input_mux; |
| 5514 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5515 | hda_nid_t nid = spec->capsrc_nids ? |
| 5516 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5517 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5518 | unsigned int i, idx; |
| 5519 | |
| 5520 | idx = ucontrol->value.enumerated.item[0]; |
| 5521 | if (idx >= imux->num_items) |
| 5522 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5523 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5524 | return 0; |
| 5525 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5526 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5527 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5528 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5529 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5530 | } |
| 5531 | *cur_val = idx; |
| 5532 | return 1; |
| 5533 | } |
| 5534 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5535 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5536 | * 2ch mode |
| 5537 | */ |
| 5538 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5539 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5540 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5541 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5542 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5543 | { } /* end */ |
| 5544 | }; |
| 5545 | |
| 5546 | /* |
| 5547 | * 6ch mode |
| 5548 | */ |
| 5549 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5550 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5551 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5552 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5553 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5554 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5555 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5556 | { } /* end */ |
| 5557 | }; |
| 5558 | |
| 5559 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5560 | { 2, alc882_3ST_ch2_init }, |
| 5561 | { 6, alc882_3ST_ch6_init }, |
| 5562 | }; |
| 5563 | |
| 5564 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5565 | * 6ch mode |
| 5566 | */ |
| 5567 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5568 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5569 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5570 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5571 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5572 | { } /* end */ |
| 5573 | }; |
| 5574 | |
| 5575 | /* |
| 5576 | * 8ch mode |
| 5577 | */ |
| 5578 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5579 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5580 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5581 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5582 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5583 | { } /* end */ |
| 5584 | }; |
| 5585 | |
| 5586 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5587 | { 6, alc882_sixstack_ch6_init }, |
| 5588 | { 8, alc882_sixstack_ch8_init }, |
| 5589 | }; |
| 5590 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5591 | /* |
| 5592 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5593 | */ |
| 5594 | |
| 5595 | /* |
| 5596 | * 2ch mode |
| 5597 | */ |
| 5598 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5599 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5600 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5601 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5602 | { } /* end */ |
| 5603 | }; |
| 5604 | |
| 5605 | /* |
| 5606 | * 6ch mode |
| 5607 | */ |
| 5608 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5609 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5610 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5611 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5612 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5613 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5614 | { } /* end */ |
| 5615 | }; |
| 5616 | |
| 5617 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5618 | { 2, alc885_mbp_ch2_init }, |
| 5619 | { 6, alc885_mbp_ch6_init }, |
| 5620 | }; |
| 5621 | |
| 5622 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5623 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5624 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5625 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5626 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5627 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5628 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5629 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5630 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5631 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5632 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5633 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5634 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5635 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5636 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5637 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5638 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5639 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5640 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5641 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5642 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5643 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5644 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5645 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5646 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5647 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5648 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5649 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5650 | { } /* end */ |
| 5651 | }; |
| 5652 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5653 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5654 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5655 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5656 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5657 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5658 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5659 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5660 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5661 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5662 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5663 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5664 | { } /* end */ |
| 5665 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5666 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5667 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5668 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5669 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5670 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5671 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5672 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5673 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5674 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5675 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5676 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5677 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5678 | { } /* end */ |
| 5679 | }; |
| 5680 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5681 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5682 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5683 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5684 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5685 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5686 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5687 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5688 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5689 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5690 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5691 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5692 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5693 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5694 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5695 | { } /* end */ |
| 5696 | }; |
| 5697 | |
| 5698 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5699 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5700 | */ |
| 5701 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5702 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5703 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5704 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5705 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5706 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5707 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5708 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5709 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5710 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5711 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5712 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5713 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5714 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5715 | { } /* end */ |
| 5716 | }; |
| 5717 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5718 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5719 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5720 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5721 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5722 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5723 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5724 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5725 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5726 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5727 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5728 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5729 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5730 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5731 | { } /* end */ |
| 5732 | }; |
| 5733 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5734 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5735 | { |
| 5736 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5737 | .name = "Channel Mode", |
| 5738 | .info = alc_ch_mode_info, |
| 5739 | .get = alc_ch_mode_get, |
| 5740 | .put = alc_ch_mode_put, |
| 5741 | }, |
| 5742 | { } /* end */ |
| 5743 | }; |
| 5744 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5745 | static struct hda_verb alc882_init_verbs[] = { |
| 5746 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5747 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5748 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5749 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5750 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5751 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5752 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5753 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5754 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5755 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5756 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5757 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5758 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5759 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5760 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5761 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5762 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5763 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5764 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5765 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5766 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5767 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5768 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5769 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5770 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5771 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5772 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5773 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5774 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5775 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5776 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5777 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5778 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5779 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5780 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5781 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5782 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5783 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5784 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5785 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5786 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5787 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5788 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5789 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5790 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5791 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5792 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5793 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5794 | |
| 5795 | /* FIXME: use matrix-type input source selection */ |
| 5796 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5797 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5798 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5799 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5800 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5801 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5802 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5803 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5804 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5805 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5806 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5807 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5808 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5809 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5810 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5811 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5812 | /* ADC1: mute amp left and right */ |
| 5813 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5814 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5815 | /* ADC2: mute amp left and right */ |
| 5816 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5817 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5818 | /* ADC3: mute amp left and right */ |
| 5819 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5820 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5821 | |
| 5822 | { } |
| 5823 | }; |
| 5824 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5825 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5826 | /* change to EAPD mode */ |
| 5827 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5828 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5829 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5830 | }; |
| 5831 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5832 | /* Mac Pro test */ |
| 5833 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5834 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5835 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5837 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5838 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5839 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5840 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5841 | { } /* end */ |
| 5842 | }; |
| 5843 | |
| 5844 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5845 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5847 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5848 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5849 | /* Front Pin: output 0 (0x0c) */ |
| 5850 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5851 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5852 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5853 | /* Front Mic pin: input vref at 80% */ |
| 5854 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5855 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5856 | /* Speaker: output */ |
| 5857 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5858 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5859 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5860 | /* Headphone output (output 0 - 0x0c) */ |
| 5861 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5862 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5863 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5864 | |
| 5865 | /* FIXME: use matrix-type input source selection */ |
| 5866 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5867 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5868 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5869 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5870 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5871 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5872 | /* Input mixer2 */ |
| 5873 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5874 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5875 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5876 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5877 | /* Input mixer3 */ |
| 5878 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5879 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5880 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5881 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5882 | /* ADC1: mute amp left and right */ |
| 5883 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5884 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5885 | /* ADC2: mute amp left and right */ |
| 5886 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5887 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5888 | /* ADC3: mute amp left and right */ |
| 5889 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5890 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5891 | |
| 5892 | { } |
| 5893 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5894 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5895 | /* Macbook Pro rev3 */ |
| 5896 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5897 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5898 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5899 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5900 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5901 | /* Rear mixer */ |
| 5902 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5903 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5904 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5905 | /* Front Pin: output 0 (0x0c) */ |
| 5906 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5907 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5908 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5909 | /* HP Pin: output 0 (0x0d) */ |
| 5910 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5911 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5912 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5913 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5914 | /* Mic (rear) pin: input vref at 80% */ |
| 5915 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5916 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5917 | /* Front Mic pin: input vref at 80% */ |
| 5918 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5919 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5920 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5921 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5922 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5923 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5924 | |
| 5925 | /* FIXME: use matrix-type input source selection */ |
| 5926 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5927 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5928 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5929 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5930 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5931 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5932 | /* Input mixer2 */ |
| 5933 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5934 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5935 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5936 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5937 | /* Input mixer3 */ |
| 5938 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5939 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5940 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5941 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5942 | /* ADC1: mute amp left and right */ |
| 5943 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5944 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5945 | /* ADC2: mute amp left and right */ |
| 5946 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5947 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5948 | /* ADC3: mute amp left and right */ |
| 5949 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5950 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5951 | |
| 5952 | { } |
| 5953 | }; |
| 5954 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5955 | /* iMac 24 mixer. */ |
| 5956 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5957 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5958 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5959 | { } /* end */ |
| 5960 | }; |
| 5961 | |
| 5962 | /* iMac 24 init verbs. */ |
| 5963 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5964 | /* Internal speakers: output 0 (0x0c) */ |
| 5965 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5966 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5967 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5968 | /* Internal speakers: output 0 (0x0c) */ |
| 5969 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5970 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5971 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5972 | /* Headphone: output 0 (0x0c) */ |
| 5973 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5974 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5975 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5976 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5977 | /* Front Mic: input vref at 80% */ |
| 5978 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5979 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5980 | { } |
| 5981 | }; |
| 5982 | |
| 5983 | /* Toggle speaker-output according to the hp-jack state */ |
| 5984 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5985 | { |
| 5986 | unsigned int present; |
| 5987 | |
| 5988 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5989 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5990 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5991 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5992 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5993 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5994 | } |
| 5995 | |
| 5996 | /* Processes unsolicited events. */ |
| 5997 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5998 | unsigned int res) |
| 5999 | { |
| 6000 | /* Headphone insertion or removal. */ |
| 6001 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6002 | alc885_imac24_automute(codec); |
| 6003 | } |
| 6004 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6005 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6006 | { |
| 6007 | unsigned int present; |
| 6008 | |
| 6009 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6010 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6011 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6012 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6013 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6014 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6015 | |
| 6016 | } |
| 6017 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6018 | unsigned int res) |
| 6019 | { |
| 6020 | /* Headphone insertion or removal. */ |
| 6021 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6022 | alc885_mbp3_automute(codec); |
| 6023 | } |
| 6024 | |
| 6025 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6026 | static struct hda_verb alc882_targa_verbs[] = { |
| 6027 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6028 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6029 | |
| 6030 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6031 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6032 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6033 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6034 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6035 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6036 | |
| 6037 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6038 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6039 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6040 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6041 | { } /* end */ |
| 6042 | }; |
| 6043 | |
| 6044 | /* toggle speaker-output according to the hp-jack state */ |
| 6045 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6046 | { |
| 6047 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6048 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6049 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6050 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6051 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6052 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6053 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6054 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6055 | } |
| 6056 | |
| 6057 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6058 | { |
| 6059 | /* Looks like the unsol event is incompatible with the standard |
| 6060 | * definition. 4bit tag is placed at 26 bit! |
| 6061 | */ |
| 6062 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6063 | alc882_targa_automute(codec); |
| 6064 | } |
| 6065 | } |
| 6066 | |
| 6067 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6068 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6069 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6070 | |
| 6071 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6072 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6073 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6074 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6075 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6076 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6077 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6078 | |
| 6079 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6080 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6081 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6082 | { } /* end */ |
| 6083 | }; |
| 6084 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6085 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6086 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6087 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6088 | |
| 6089 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6090 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6091 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6092 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6093 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6094 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6095 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6096 | |
| 6097 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6098 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6099 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6100 | { } /* end */ |
| 6101 | }; |
| 6102 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6103 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6104 | { |
| 6105 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6106 | |
| 6107 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6108 | AC_VERB_GET_GPIO_DATA, 0); |
| 6109 | |
| 6110 | if (!muted) |
| 6111 | gpiostate |= (1 << pin); |
| 6112 | else |
| 6113 | gpiostate &= ~(1 << pin); |
| 6114 | |
| 6115 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6116 | AC_VERB_GET_GPIO_MASK, 0); |
| 6117 | gpiomask |= (1 << pin); |
| 6118 | |
| 6119 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6120 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6121 | gpiodir |= (1 << pin); |
| 6122 | |
| 6123 | |
| 6124 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6125 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6126 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6127 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6128 | |
| 6129 | msleep(1); |
| 6130 | |
| 6131 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6132 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6133 | } |
| 6134 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6135 | /* set up GPIO at initialization */ |
| 6136 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6137 | { |
| 6138 | alc882_gpio_mute(codec, 0, 0); |
| 6139 | alc882_gpio_mute(codec, 1, 0); |
| 6140 | } |
| 6141 | |
| 6142 | /* set up GPIO and update auto-muting at initialization */ |
| 6143 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6144 | { |
| 6145 | alc885_macpro_init_hook(codec); |
| 6146 | alc885_imac24_automute(codec); |
| 6147 | } |
| 6148 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6149 | /* |
| 6150 | * generic initialization of ADC, input mixers and output mixers |
| 6151 | */ |
| 6152 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6153 | /* |
| 6154 | * Unmute ADC0-2 and set the default input to mic-in |
| 6155 | */ |
| 6156 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6157 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6158 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6159 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6160 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6161 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6162 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6163 | /* 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] | 6164 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6165 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6166 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6167 | */ |
| 6168 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6169 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6170 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6171 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6172 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6173 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6174 | |
| 6175 | /* |
| 6176 | * Set up output mixers (0x0c - 0x0f) |
| 6177 | */ |
| 6178 | /* set vol=0 to output mixers */ |
| 6179 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6180 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6181 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6182 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6183 | /* set up input amps for analog loopback */ |
| 6184 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6185 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6186 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6187 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6188 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6189 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6190 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6191 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6192 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6193 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6194 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6195 | |
| 6196 | /* FIXME: use matrix-type input source selection */ |
| 6197 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6198 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6199 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6200 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6201 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6202 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6203 | /* Input mixer2 */ |
| 6204 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6205 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6206 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6207 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6208 | /* Input mixer3 */ |
| 6209 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6210 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6211 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6212 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6213 | |
| 6214 | { } |
| 6215 | }; |
| 6216 | |
| 6217 | /* capture mixer elements */ |
| 6218 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 6219 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6220 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6221 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6222 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6223 | { |
| 6224 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6225 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6226 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6227 | */ |
| 6228 | /* .name = "Capture Source", */ |
| 6229 | .name = "Input Source", |
| 6230 | .count = 2, |
| 6231 | .info = alc882_mux_enum_info, |
| 6232 | .get = alc882_mux_enum_get, |
| 6233 | .put = alc882_mux_enum_put, |
| 6234 | }, |
| 6235 | { } /* end */ |
| 6236 | }; |
| 6237 | |
| 6238 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 6239 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 6240 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 6241 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 6242 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 6243 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 6244 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 6245 | { |
| 6246 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6247 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6248 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6249 | */ |
| 6250 | /* .name = "Capture Source", */ |
| 6251 | .name = "Input Source", |
| 6252 | .count = 3, |
| 6253 | .info = alc882_mux_enum_info, |
| 6254 | .get = alc882_mux_enum_get, |
| 6255 | .put = alc882_mux_enum_put, |
| 6256 | }, |
| 6257 | { } /* end */ |
| 6258 | }; |
| 6259 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6260 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6261 | #define alc882_loopbacks alc880_loopbacks |
| 6262 | #endif |
| 6263 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6264 | /* pcm configuration: identiacal with ALC880 */ |
| 6265 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6266 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6267 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6268 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6269 | |
| 6270 | /* |
| 6271 | * configuration and preset |
| 6272 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6273 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6274 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6275 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6276 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6277 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6278 | [ALC882_TARGA] = "targa", |
| 6279 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6280 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6281 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6282 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6283 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6284 | [ALC882_AUTO] = "auto", |
| 6285 | }; |
| 6286 | |
| 6287 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6288 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6289 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6290 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6291 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6292 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6293 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6294 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6295 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6296 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6297 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6298 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6299 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6300 | {} |
| 6301 | }; |
| 6302 | |
| 6303 | static struct alc_config_preset alc882_presets[] = { |
| 6304 | [ALC882_3ST_DIG] = { |
| 6305 | .mixers = { alc882_base_mixer }, |
| 6306 | .init_verbs = { alc882_init_verbs }, |
| 6307 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6308 | .dac_nids = alc882_dac_nids, |
| 6309 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6310 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6311 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6312 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6313 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6314 | .input_mux = &alc882_capture_source, |
| 6315 | }, |
| 6316 | [ALC882_6ST_DIG] = { |
| 6317 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6318 | .init_verbs = { alc882_init_verbs }, |
| 6319 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6320 | .dac_nids = alc882_dac_nids, |
| 6321 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6322 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6323 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6324 | .channel_mode = alc882_sixstack_modes, |
| 6325 | .input_mux = &alc882_capture_source, |
| 6326 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6327 | [ALC882_ARIMA] = { |
| 6328 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6329 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6330 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6331 | .dac_nids = alc882_dac_nids, |
| 6332 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6333 | .channel_mode = alc882_sixstack_modes, |
| 6334 | .input_mux = &alc882_capture_source, |
| 6335 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6336 | [ALC882_W2JC] = { |
| 6337 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6338 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6339 | alc880_gpio1_init_verbs }, |
| 6340 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6341 | .dac_nids = alc882_dac_nids, |
| 6342 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6343 | .channel_mode = alc880_threestack_modes, |
| 6344 | .need_dac_fix = 1, |
| 6345 | .input_mux = &alc882_capture_source, |
| 6346 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6347 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6348 | [ALC885_MBP3] = { |
| 6349 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6350 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6351 | alc880_gpio1_init_verbs }, |
| 6352 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6353 | .dac_nids = alc882_dac_nids, |
| 6354 | .channel_mode = alc885_mbp_6ch_modes, |
| 6355 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6356 | .input_mux = &alc882_capture_source, |
| 6357 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6358 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6359 | .unsol_event = alc885_mbp3_unsol_event, |
| 6360 | .init_hook = alc885_mbp3_automute, |
| 6361 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6362 | [ALC885_MACPRO] = { |
| 6363 | .mixers = { alc882_macpro_mixer }, |
| 6364 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6365 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6366 | .dac_nids = alc882_dac_nids, |
| 6367 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6368 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6369 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6370 | .channel_mode = alc882_ch_modes, |
| 6371 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6372 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6373 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6374 | [ALC885_IMAC24] = { |
| 6375 | .mixers = { alc885_imac24_mixer }, |
| 6376 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6377 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6378 | .dac_nids = alc882_dac_nids, |
| 6379 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6380 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6381 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6382 | .channel_mode = alc882_ch_modes, |
| 6383 | .input_mux = &alc882_capture_source, |
| 6384 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6385 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6386 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6387 | [ALC882_TARGA] = { |
| 6388 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6389 | alc882_capture_mixer }, |
| 6390 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6391 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6392 | .dac_nids = alc882_dac_nids, |
| 6393 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6394 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6395 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6396 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6397 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6398 | .channel_mode = alc882_3ST_6ch_modes, |
| 6399 | .need_dac_fix = 1, |
| 6400 | .input_mux = &alc882_capture_source, |
| 6401 | .unsol_event = alc882_targa_unsol_event, |
| 6402 | .init_hook = alc882_targa_automute, |
| 6403 | }, |
| 6404 | [ALC882_ASUS_A7J] = { |
| 6405 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6406 | alc882_capture_mixer }, |
| 6407 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6408 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6409 | .dac_nids = alc882_dac_nids, |
| 6410 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6411 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6412 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6413 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6414 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6415 | .channel_mode = alc882_3ST_6ch_modes, |
| 6416 | .need_dac_fix = 1, |
| 6417 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6418 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6419 | [ALC882_ASUS_A7M] = { |
| 6420 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6421 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6422 | alc880_gpio1_init_verbs, |
| 6423 | alc882_asus_a7m_verbs }, |
| 6424 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6425 | .dac_nids = alc882_dac_nids, |
| 6426 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6427 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6428 | .channel_mode = alc880_threestack_modes, |
| 6429 | .need_dac_fix = 1, |
| 6430 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6431 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6432 | }; |
| 6433 | |
| 6434 | |
| 6435 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6436 | * Pin config fixes |
| 6437 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6438 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6439 | PINFIX_ABIT_AW9D_MAX |
| 6440 | }; |
| 6441 | |
| 6442 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6443 | { 0x15, 0x01080104 }, /* side */ |
| 6444 | { 0x16, 0x01011012 }, /* rear */ |
| 6445 | { 0x17, 0x01016011 }, /* clfe */ |
| 6446 | { } |
| 6447 | }; |
| 6448 | |
| 6449 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6450 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6451 | }; |
| 6452 | |
| 6453 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6454 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6455 | {} |
| 6456 | }; |
| 6457 | |
| 6458 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6459 | * BIOS auto configuration |
| 6460 | */ |
| 6461 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6462 | hda_nid_t nid, int pin_type, |
| 6463 | int dac_idx) |
| 6464 | { |
| 6465 | /* set as output */ |
| 6466 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6467 | int idx; |
| 6468 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6469 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6470 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6471 | idx = 4; |
| 6472 | else |
| 6473 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6474 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6475 | |
| 6476 | } |
| 6477 | |
| 6478 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6479 | { |
| 6480 | struct alc_spec *spec = codec->spec; |
| 6481 | int i; |
| 6482 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6483 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6484 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6485 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6486 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6487 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6488 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6489 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6490 | } |
| 6491 | } |
| 6492 | |
| 6493 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6494 | { |
| 6495 | struct alc_spec *spec = codec->spec; |
| 6496 | hda_nid_t pin; |
| 6497 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6498 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6499 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6500 | /* use dac 0 */ |
| 6501 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6502 | pin = spec->autocfg.speaker_pins[0]; |
| 6503 | if (pin) |
| 6504 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6505 | } |
| 6506 | |
| 6507 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6508 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6509 | |
| 6510 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6511 | { |
| 6512 | struct alc_spec *spec = codec->spec; |
| 6513 | int i; |
| 6514 | |
| 6515 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6516 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6517 | unsigned int vref; |
| 6518 | if (!nid) |
| 6519 | continue; |
| 6520 | vref = PIN_IN; |
| 6521 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6522 | unsigned int pincap; |
| 6523 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6524 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6525 | AC_PINCAP_VREF_80) |
| 6526 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6527 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6528 | snd_hda_codec_write(codec, nid, 0, |
| 6529 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6530 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6531 | snd_hda_codec_write(codec, nid, 0, |
| 6532 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6533 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6534 | } |
| 6535 | } |
| 6536 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6537 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 6538 | { |
| 6539 | struct alc_spec *spec = codec->spec; |
| 6540 | const struct hda_input_mux *imux = spec->input_mux; |
| 6541 | int c; |
| 6542 | |
| 6543 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 6544 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 6545 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 6546 | int conns, mute, idx, item; |
| 6547 | |
| 6548 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 6549 | ARRAY_SIZE(conn_list)); |
| 6550 | if (conns < 0) |
| 6551 | continue; |
| 6552 | for (idx = 0; idx < conns; idx++) { |
| 6553 | /* if the current connection is the selected one, |
| 6554 | * unmute it as default - otherwise mute it |
| 6555 | */ |
| 6556 | mute = AMP_IN_MUTE(idx); |
| 6557 | for (item = 0; item < imux->num_items; item++) { |
| 6558 | if (imux->items[item].index == idx) { |
| 6559 | if (spec->cur_mux[c] == item) |
| 6560 | mute = AMP_IN_UNMUTE(idx); |
| 6561 | break; |
| 6562 | } |
| 6563 | } |
| 6564 | snd_hda_codec_write(codec, nid, 0, |
| 6565 | AC_VERB_SET_AMP_GAIN_MUTE, mute); |
| 6566 | } |
| 6567 | } |
| 6568 | } |
| 6569 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6570 | /* add mic boosts if needed */ |
| 6571 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6572 | { |
| 6573 | struct alc_spec *spec = codec->spec; |
| 6574 | int err; |
| 6575 | hda_nid_t nid; |
| 6576 | |
| 6577 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6578 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6579 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6580 | "Mic Boost", |
| 6581 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6582 | if (err < 0) |
| 6583 | return err; |
| 6584 | } |
| 6585 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6586 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6587 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6588 | "Front Mic Boost", |
| 6589 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6590 | if (err < 0) |
| 6591 | return err; |
| 6592 | } |
| 6593 | return 0; |
| 6594 | } |
| 6595 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6596 | /* almost identical with ALC880 parser... */ |
| 6597 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6598 | { |
| 6599 | struct alc_spec *spec = codec->spec; |
| 6600 | int err = alc880_parse_auto_config(codec); |
| 6601 | |
| 6602 | if (err < 0) |
| 6603 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6604 | else if (!err) |
| 6605 | return 0; /* no config found */ |
| 6606 | |
| 6607 | err = alc_auto_add_mic_boost(codec); |
| 6608 | if (err < 0) |
| 6609 | return err; |
| 6610 | |
| 6611 | /* hack - override the init verbs */ |
| 6612 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6613 | |
| 6614 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6615 | } |
| 6616 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6617 | /* additional initialization for auto-configuration model */ |
| 6618 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6619 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6620 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6621 | alc882_auto_init_multi_out(codec); |
| 6622 | alc882_auto_init_hp_out(codec); |
| 6623 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6624 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6625 | if (spec->unsol_event) |
| 6626 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6627 | } |
| 6628 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6629 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6630 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6631 | static int patch_alc882(struct hda_codec *codec) |
| 6632 | { |
| 6633 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6634 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6635 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6636 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6637 | if (spec == NULL) |
| 6638 | return -ENOMEM; |
| 6639 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6640 | codec->spec = spec; |
| 6641 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6642 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6643 | alc882_models, |
| 6644 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6645 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6646 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6647 | /* Pick up systems that don't supply PCI SSID */ |
| 6648 | switch (codec->subsystem_id) { |
| 6649 | case 0x106b0c00: /* Mac Pro */ |
| 6650 | board_config = ALC885_MACPRO; |
| 6651 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6652 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 6653 | case 0x106b2800: /* AppleTV */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6654 | board_config = ALC885_IMAC24; |
| 6655 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6656 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 6657 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6658 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6659 | case 0x106b3600: /* Macbook 3.1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6660 | board_config = ALC885_MBP3; |
| 6661 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6662 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6663 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 6664 | if (codec->revision_id == 0x100101 || |
| 6665 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6666 | alc_free(codec); |
| 6667 | return patch_alc883(codec); |
| 6668 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6669 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6670 | "trying auto-probe from BIOS...\n"); |
| 6671 | board_config = ALC882_AUTO; |
| 6672 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6673 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6674 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6675 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6676 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6677 | if (board_config == ALC882_AUTO) { |
| 6678 | /* automatic parse from the BIOS config */ |
| 6679 | err = alc882_parse_auto_config(codec); |
| 6680 | if (err < 0) { |
| 6681 | alc_free(codec); |
| 6682 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6683 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6684 | printk(KERN_INFO |
| 6685 | "hda_codec: Cannot set up configuration " |
| 6686 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6687 | board_config = ALC882_3ST_DIG; |
| 6688 | } |
| 6689 | } |
| 6690 | |
| 6691 | if (board_config != ALC882_AUTO) |
| 6692 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6693 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 6694 | if (codec->vendor_id == 0x10ec0885) { |
| 6695 | spec->stream_name_analog = "ALC885 Analog"; |
| 6696 | spec->stream_name_digital = "ALC885 Digital"; |
| 6697 | } else { |
| 6698 | spec->stream_name_analog = "ALC882 Analog"; |
| 6699 | spec->stream_name_digital = "ALC882 Digital"; |
| 6700 | } |
| 6701 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6702 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6703 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6704 | /* FIXME: setup DAC5 */ |
| 6705 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6706 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6707 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6708 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6709 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6710 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6711 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6712 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6713 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6714 | /* get type */ |
| 6715 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6716 | if (wcap != AC_WID_AUD_IN) { |
| 6717 | spec->adc_nids = alc882_adc_nids_alt; |
| 6718 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6719 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6720 | spec->mixers[spec->num_mixers] = |
| 6721 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6722 | spec->num_mixers++; |
| 6723 | } else { |
| 6724 | spec->adc_nids = alc882_adc_nids; |
| 6725 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6726 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6727 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6728 | spec->num_mixers++; |
| 6729 | } |
| 6730 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6731 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6732 | spec->vmaster_nid = 0x0c; |
| 6733 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6734 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6735 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6736 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6737 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6738 | if (!spec->loopback.amplist) |
| 6739 | spec->loopback.amplist = alc882_loopbacks; |
| 6740 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6741 | |
| 6742 | return 0; |
| 6743 | } |
| 6744 | |
| 6745 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6746 | * ALC883 support |
| 6747 | * |
| 6748 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6749 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6750 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6751 | * 6-channel independent captures. |
| 6752 | * |
| 6753 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6754 | * driver yet). |
| 6755 | */ |
| 6756 | #define ALC883_DIGOUT_NID 0x06 |
| 6757 | #define ALC883_DIGIN_NID 0x0a |
| 6758 | |
| 6759 | static hda_nid_t alc883_dac_nids[4] = { |
| 6760 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6761 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6762 | }; |
| 6763 | |
| 6764 | static hda_nid_t alc883_adc_nids[2] = { |
| 6765 | /* ADC1-2 */ |
| 6766 | 0x08, 0x09, |
| 6767 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6768 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6769 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6770 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6771 | /* input MUX */ |
| 6772 | /* FIXME: should be a matrix-type input source selection */ |
| 6773 | |
| 6774 | static struct hda_input_mux alc883_capture_source = { |
| 6775 | .num_items = 4, |
| 6776 | .items = { |
| 6777 | { "Mic", 0x0 }, |
| 6778 | { "Front Mic", 0x1 }, |
| 6779 | { "Line", 0x2 }, |
| 6780 | { "CD", 0x4 }, |
| 6781 | }, |
| 6782 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6783 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6784 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6785 | .num_items = 4, |
| 6786 | .items = { |
| 6787 | { "Mic", 0x1 }, |
| 6788 | { "Front Mic", 0x0 }, |
| 6789 | { "Line", 0x2 }, |
| 6790 | { "CD", 0x4 }, |
| 6791 | }, |
| 6792 | }; |
| 6793 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6794 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6795 | .num_items = 2, |
| 6796 | .items = { |
| 6797 | { "Mic", 0x1 }, |
| 6798 | { "Line", 0x2 }, |
| 6799 | }, |
| 6800 | }; |
| 6801 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6802 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6803 | .num_items = 4, |
| 6804 | .items = { |
| 6805 | { "Mic", 0x0 }, |
| 6806 | { "iMic", 0x1 }, |
| 6807 | { "Line", 0x2 }, |
| 6808 | { "CD", 0x4 }, |
| 6809 | }, |
| 6810 | }; |
| 6811 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6812 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6813 | .num_items = 2, |
| 6814 | .items = { |
| 6815 | { "Mic", 0x0 }, |
| 6816 | { "Int Mic", 0x1 }, |
| 6817 | }, |
| 6818 | }; |
| 6819 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 6820 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6821 | .num_items = 3, |
| 6822 | .items = { |
| 6823 | { "Mic", 0x0 }, |
| 6824 | { "Front Mic", 0x1 }, |
| 6825 | { "Line", 0x4 }, |
| 6826 | }, |
| 6827 | }; |
| 6828 | |
| 6829 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6830 | .num_items = 2, |
| 6831 | .items = { |
| 6832 | { "Mic", 0x0 }, |
| 6833 | { "Line", 0x2 }, |
| 6834 | }, |
| 6835 | }; |
| 6836 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6837 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6838 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6839 | /* ALC883 has the ALC882-type input selection */ |
| 6840 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6841 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6842 | /* |
| 6843 | * 2ch mode |
| 6844 | */ |
| 6845 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6846 | { 2, NULL } |
| 6847 | }; |
| 6848 | |
| 6849 | /* |
| 6850 | * 2ch mode |
| 6851 | */ |
| 6852 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6853 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6854 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6855 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6856 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6857 | { } /* end */ |
| 6858 | }; |
| 6859 | |
| 6860 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6861 | * 4ch mode |
| 6862 | */ |
| 6863 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6864 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6865 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6866 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6867 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6868 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6869 | { } /* end */ |
| 6870 | }; |
| 6871 | |
| 6872 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6873 | * 6ch mode |
| 6874 | */ |
| 6875 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6876 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6877 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6878 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6879 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6880 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6881 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6882 | { } /* end */ |
| 6883 | }; |
| 6884 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6885 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6886 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6887 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6888 | { 6, alc883_3ST_ch6_init }, |
| 6889 | }; |
| 6890 | |
| 6891 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6892 | * 2ch mode |
| 6893 | */ |
| 6894 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6895 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6896 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6897 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6898 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6899 | { } /* end */ |
| 6900 | }; |
| 6901 | |
| 6902 | /* |
| 6903 | * 4ch mode |
| 6904 | */ |
| 6905 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6906 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6907 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6908 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6909 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6910 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6911 | { } /* end */ |
| 6912 | }; |
| 6913 | |
| 6914 | /* |
| 6915 | * 6ch mode |
| 6916 | */ |
| 6917 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6918 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6919 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6920 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6921 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6922 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6923 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6924 | { } /* end */ |
| 6925 | }; |
| 6926 | |
| 6927 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6928 | { 2, alc883_3ST_ch2_intel_init }, |
| 6929 | { 4, alc883_3ST_ch4_intel_init }, |
| 6930 | { 6, alc883_3ST_ch6_intel_init }, |
| 6931 | }; |
| 6932 | |
| 6933 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6934 | * 6ch mode |
| 6935 | */ |
| 6936 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6937 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6938 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6939 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6940 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6941 | { } /* end */ |
| 6942 | }; |
| 6943 | |
| 6944 | /* |
| 6945 | * 8ch mode |
| 6946 | */ |
| 6947 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6948 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6949 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6950 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6951 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6952 | { } /* end */ |
| 6953 | }; |
| 6954 | |
| 6955 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6956 | { 6, alc883_sixstack_ch6_init }, |
| 6957 | { 8, alc883_sixstack_ch8_init }, |
| 6958 | }; |
| 6959 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6960 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6961 | /* eanable EAPD on medion laptop */ |
| 6962 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6963 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6964 | { } |
| 6965 | }; |
| 6966 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6967 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6968 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6969 | */ |
| 6970 | |
| 6971 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6972 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6973 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6974 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6975 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6976 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6977 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6978 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6979 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6980 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6981 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6982 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6983 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6984 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6985 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6986 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6987 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6988 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6989 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6990 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6991 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6992 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6993 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6994 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6995 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6996 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6997 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6998 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6999 | { |
| 7000 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7001 | /* .name = "Capture Source", */ |
| 7002 | .name = "Input Source", |
| 7003 | .count = 2, |
| 7004 | .info = alc883_mux_enum_info, |
| 7005 | .get = alc883_mux_enum_get, |
| 7006 | .put = alc883_mux_enum_put, |
| 7007 | }, |
| 7008 | { } /* end */ |
| 7009 | }; |
| 7010 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7011 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7012 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7013 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7014 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7015 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7016 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7017 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7018 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7019 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7020 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7022 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7023 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7024 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7025 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7026 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7027 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7028 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7029 | { |
| 7030 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7031 | /* .name = "Capture Source", */ |
| 7032 | .name = "Input Source", |
| 7033 | .count = 2, |
| 7034 | .info = alc883_mux_enum_info, |
| 7035 | .get = alc883_mux_enum_get, |
| 7036 | .put = alc883_mux_enum_put, |
| 7037 | }, |
| 7038 | { } /* end */ |
| 7039 | }; |
| 7040 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7041 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7042 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7043 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7044 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7045 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7046 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7047 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7048 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7049 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7050 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7051 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7052 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7053 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7054 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7055 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7056 | { |
| 7057 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7058 | /* .name = "Capture Source", */ |
| 7059 | .name = "Input Source", |
| 7060 | .count = 2, |
| 7061 | .info = alc883_mux_enum_info, |
| 7062 | .get = alc883_mux_enum_get, |
| 7063 | .put = alc883_mux_enum_put, |
| 7064 | }, |
| 7065 | { } /* end */ |
| 7066 | }; |
| 7067 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7068 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7069 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7070 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7071 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7072 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7073 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7074 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7075 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7076 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7077 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7078 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7079 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7080 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7081 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7082 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7083 | { |
| 7084 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7085 | /* .name = "Capture Source", */ |
| 7086 | .name = "Input Source", |
| 7087 | .count = 2, |
| 7088 | .info = alc883_mux_enum_info, |
| 7089 | .get = alc883_mux_enum_get, |
| 7090 | .put = alc883_mux_enum_put, |
| 7091 | }, |
| 7092 | { } /* end */ |
| 7093 | }; |
| 7094 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7095 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7096 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7097 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7098 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7099 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7100 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7101 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7102 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7103 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7104 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7105 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7106 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7107 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7108 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7109 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7110 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7111 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7112 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7113 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7114 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7115 | { |
| 7116 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7117 | /* .name = "Capture Source", */ |
| 7118 | .name = "Input Source", |
| 7119 | .count = 2, |
| 7120 | .info = alc883_mux_enum_info, |
| 7121 | .get = alc883_mux_enum_get, |
| 7122 | .put = alc883_mux_enum_put, |
| 7123 | }, |
| 7124 | { } /* end */ |
| 7125 | }; |
| 7126 | |
| 7127 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7128 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7129 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7130 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7131 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7132 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7133 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7134 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7135 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7136 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7137 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7138 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7139 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7140 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7141 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7142 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7143 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7144 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7145 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7146 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7147 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7148 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7149 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7150 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7151 | { |
| 7152 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7153 | /* .name = "Capture Source", */ |
| 7154 | .name = "Input Source", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7155 | .count = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7156 | .info = alc883_mux_enum_info, |
| 7157 | .get = alc883_mux_enum_get, |
| 7158 | .put = alc883_mux_enum_put, |
| 7159 | }, |
| 7160 | { } /* end */ |
| 7161 | }; |
| 7162 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7163 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7164 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7165 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7166 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7167 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7168 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7169 | HDA_OUTPUT), |
| 7170 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7171 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7172 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7173 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7174 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7175 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7176 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7177 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7178 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7179 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7180 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7181 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7182 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7183 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7184 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7185 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7186 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7187 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7188 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7189 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7190 | { |
| 7191 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7192 | /* .name = "Capture Source", */ |
| 7193 | .name = "Input Source", |
| 7194 | .count = 2, |
| 7195 | .info = alc883_mux_enum_info, |
| 7196 | .get = alc883_mux_enum_get, |
| 7197 | .put = alc883_mux_enum_put, |
| 7198 | }, |
| 7199 | { } /* end */ |
| 7200 | }; |
| 7201 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7202 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7203 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7204 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7205 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7206 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7207 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7208 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7209 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7210 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7211 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7212 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7213 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7214 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7215 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7216 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7217 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7218 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7219 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7220 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7221 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7222 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7223 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7224 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7225 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7226 | |
| 7227 | { |
| 7228 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7229 | /* .name = "Capture Source", */ |
| 7230 | .name = "Input Source", |
| 7231 | .count = 1, |
| 7232 | .info = alc883_mux_enum_info, |
| 7233 | .get = alc883_mux_enum_get, |
| 7234 | .put = alc883_mux_enum_put, |
| 7235 | }, |
| 7236 | { } /* end */ |
| 7237 | }; |
| 7238 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7239 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7240 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7241 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7242 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7243 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7244 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7245 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7246 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7247 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7248 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7249 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7250 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7251 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7252 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7254 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7255 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7256 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7257 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7258 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7259 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7260 | { |
| 7261 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7262 | /* .name = "Capture Source", */ |
| 7263 | .name = "Input Source", |
| 7264 | .count = 2, |
| 7265 | .info = alc883_mux_enum_info, |
| 7266 | .get = alc883_mux_enum_get, |
| 7267 | .put = alc883_mux_enum_put, |
| 7268 | }, |
| 7269 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7270 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7271 | |
| 7272 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7273 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7274 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7275 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7276 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7277 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7278 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7279 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7280 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7281 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7282 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7283 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7284 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7285 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7286 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7287 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7288 | { |
| 7289 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7290 | /* .name = "Capture Source", */ |
| 7291 | .name = "Input Source", |
| 7292 | .count = 2, |
| 7293 | .info = alc883_mux_enum_info, |
| 7294 | .get = alc883_mux_enum_get, |
| 7295 | .put = alc883_mux_enum_put, |
| 7296 | }, |
| 7297 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7298 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7299 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7300 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7301 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7302 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7303 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7304 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7305 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7306 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7307 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7308 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7309 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7310 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7311 | { |
| 7312 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7313 | /* .name = "Capture Source", */ |
| 7314 | .name = "Input Source", |
| 7315 | .count = 1, |
| 7316 | .info = alc883_mux_enum_info, |
| 7317 | .get = alc883_mux_enum_get, |
| 7318 | .put = alc883_mux_enum_put, |
| 7319 | }, |
| 7320 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7321 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7322 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7323 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7324 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7325 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7326 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7327 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7328 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7329 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7330 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7331 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7332 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7333 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7334 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7335 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7336 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7337 | { |
| 7338 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7339 | /* .name = "Capture Source", */ |
| 7340 | .name = "Input Source", |
| 7341 | .count = 2, |
| 7342 | .info = alc883_mux_enum_info, |
| 7343 | .get = alc883_mux_enum_get, |
| 7344 | .put = alc883_mux_enum_put, |
| 7345 | }, |
| 7346 | { } /* end */ |
| 7347 | }; |
| 7348 | |
| 7349 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7350 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7351 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7352 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7353 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7354 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7355 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7356 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7357 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7358 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7359 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7360 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7361 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7362 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7363 | { |
| 7364 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7365 | /* .name = "Capture Source", */ |
| 7366 | .name = "Input Source", |
| 7367 | .count = 2, |
| 7368 | .info = alc883_mux_enum_info, |
| 7369 | .get = alc883_mux_enum_get, |
| 7370 | .put = alc883_mux_enum_put, |
| 7371 | }, |
| 7372 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7373 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7374 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7375 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7376 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7377 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7378 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7379 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7380 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7381 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7382 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7383 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7384 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7385 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7386 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7387 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7388 | { |
| 7389 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7390 | /* .name = "Capture Source", */ |
| 7391 | .name = "Input Source", |
| 7392 | .count = 2, |
| 7393 | .info = alc883_mux_enum_info, |
| 7394 | .get = alc883_mux_enum_get, |
| 7395 | .put = alc883_mux_enum_put, |
| 7396 | }, |
| 7397 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7398 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7399 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7400 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7401 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7402 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7403 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7404 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7405 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7406 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7407 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7408 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7409 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7410 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7411 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7412 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7413 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7414 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7415 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7416 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7417 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7418 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7419 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7420 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7421 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7422 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7423 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7424 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7425 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7426 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7427 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7428 | { |
| 7429 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7430 | /* .name = "Capture Source", */ |
| 7431 | .name = "Input Source", |
| 7432 | .count = 2, |
| 7433 | .info = alc883_mux_enum_info, |
| 7434 | .get = alc883_mux_enum_get, |
| 7435 | .put = alc883_mux_enum_put, |
| 7436 | }, |
| 7437 | { } /* end */ |
| 7438 | }; |
| 7439 | |
| 7440 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7441 | .ops = &snd_hda_bind_vol, |
| 7442 | .values = { |
| 7443 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7444 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7445 | 0 |
| 7446 | }, |
| 7447 | }; |
| 7448 | |
| 7449 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7450 | .ops = &snd_hda_bind_sw, |
| 7451 | .values = { |
| 7452 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7453 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7454 | 0 |
| 7455 | }, |
| 7456 | }; |
| 7457 | |
| 7458 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7459 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7460 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7461 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7462 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7463 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7464 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7465 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7466 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7467 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7468 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7469 | { |
| 7470 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7471 | /* .name = "Capture Source", */ |
| 7472 | .name = "Input Source", |
| 7473 | .count = 1, |
| 7474 | .info = alc883_mux_enum_info, |
| 7475 | .get = alc883_mux_enum_get, |
| 7476 | .put = alc883_mux_enum_put, |
| 7477 | }, |
| 7478 | { } /* end */ |
| 7479 | }; |
| 7480 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7481 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7482 | { |
| 7483 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7484 | .name = "Channel Mode", |
| 7485 | .info = alc_ch_mode_info, |
| 7486 | .get = alc_ch_mode_get, |
| 7487 | .put = alc_ch_mode_put, |
| 7488 | }, |
| 7489 | { } /* end */ |
| 7490 | }; |
| 7491 | |
| 7492 | static struct hda_verb alc883_init_verbs[] = { |
| 7493 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7494 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7495 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7496 | /* ADC2: mute amp left and right */ |
| 7497 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7498 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7499 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7500 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7501 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7502 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7503 | /* Rear mixer */ |
| 7504 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7505 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7506 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7507 | /* CLFE mixer */ |
| 7508 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7509 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7510 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7511 | /* Side mixer */ |
| 7512 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7513 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7514 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7515 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7516 | /* mute analog input loopbacks */ |
| 7517 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7520 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7521 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7522 | |
| 7523 | /* Front Pin: output 0 (0x0c) */ |
| 7524 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7525 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7526 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7527 | /* Rear Pin: output 1 (0x0d) */ |
| 7528 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7529 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7530 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7531 | /* CLFE Pin: output 2 (0x0e) */ |
| 7532 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7533 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7534 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7535 | /* Side Pin: output 3 (0x0f) */ |
| 7536 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7537 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7538 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7539 | /* Mic (rear) pin: input vref at 80% */ |
| 7540 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7541 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7542 | /* Front Mic pin: input vref at 80% */ |
| 7543 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7544 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7545 | /* Line In pin: input */ |
| 7546 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7547 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7548 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7549 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7550 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7551 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7552 | /* CD pin widget for input */ |
| 7553 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7554 | |
| 7555 | /* FIXME: use matrix-type input source selection */ |
| 7556 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7557 | /* Input mixer2 */ |
| 7558 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7559 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7560 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7561 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7562 | /* Input mixer3 */ |
| 7563 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7564 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7565 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7566 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7567 | { } |
| 7568 | }; |
| 7569 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7570 | /* toggle speaker-output according to the hp-jack state */ |
| 7571 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7572 | { |
| 7573 | unsigned int present; |
| 7574 | |
| 7575 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7576 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7577 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7578 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7579 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7580 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7581 | } |
| 7582 | |
| 7583 | /* auto-toggle front mic */ |
| 7584 | /* |
| 7585 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7586 | { |
| 7587 | unsigned int present; |
| 7588 | unsigned char bits; |
| 7589 | |
| 7590 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7591 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7592 | bits = present ? HDA_AMP_MUTE : 0; |
| 7593 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7594 | } |
| 7595 | */ |
| 7596 | |
| 7597 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7598 | { |
| 7599 | alc883_mitac_hp_automute(codec); |
| 7600 | /* alc883_mitac_mic_automute(codec); */ |
| 7601 | } |
| 7602 | |
| 7603 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7604 | unsigned int res) |
| 7605 | { |
| 7606 | switch (res >> 26) { |
| 7607 | case ALC880_HP_EVENT: |
| 7608 | alc883_mitac_hp_automute(codec); |
| 7609 | break; |
| 7610 | case ALC880_MIC_EVENT: |
| 7611 | /* alc883_mitac_mic_automute(codec); */ |
| 7612 | break; |
| 7613 | } |
| 7614 | } |
| 7615 | |
| 7616 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7617 | /* HP */ |
| 7618 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7619 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7620 | /* Subwoofer */ |
| 7621 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7622 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7623 | |
| 7624 | /* enable unsolicited event */ |
| 7625 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7626 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7627 | |
| 7628 | { } /* end */ |
| 7629 | }; |
| 7630 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7631 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7632 | /* HP */ |
| 7633 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7634 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7635 | /* Int speaker */ |
| 7636 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7638 | |
| 7639 | /* enable unsolicited event */ |
| 7640 | {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] | 7641 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7642 | |
| 7643 | { } /* end */ |
| 7644 | }; |
| 7645 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7646 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7647 | /* HP */ |
| 7648 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7649 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7650 | /* Subwoofer */ |
| 7651 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7652 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7653 | |
| 7654 | /* enable unsolicited event */ |
| 7655 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7656 | |
| 7657 | { } /* end */ |
| 7658 | }; |
| 7659 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7660 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7661 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7662 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7663 | |
| 7664 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7665 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7666 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7667 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7668 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7669 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7670 | |
| 7671 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7672 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7673 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7674 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7675 | |
| 7676 | { } /* end */ |
| 7677 | }; |
| 7678 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7679 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7680 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7681 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7682 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7683 | { } /* end */ |
| 7684 | }; |
| 7685 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7686 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7687 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7688 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7689 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7690 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7691 | { } /* end */ |
| 7692 | }; |
| 7693 | |
| 7694 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7695 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7696 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7697 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7698 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7699 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7700 | { } /* end */ |
| 7701 | }; |
| 7702 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7703 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7704 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7705 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7706 | |
| 7707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7708 | |
| 7709 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7710 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7711 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7712 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7713 | { } /* end */ |
| 7714 | }; |
| 7715 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7716 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 7717 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7718 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7719 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7720 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7721 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7722 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7723 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7724 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7725 | { } /* end */ |
| 7726 | }; |
| 7727 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7728 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7729 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7730 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7731 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7732 | { } |
| 7733 | }; |
| 7734 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7735 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7736 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7737 | { } |
| 7738 | }; |
| 7739 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7740 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7741 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7742 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7743 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7744 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7745 | { } |
| 7746 | }; |
| 7747 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7748 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7749 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7750 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7751 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7752 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7753 | { } |
| 7754 | }; |
| 7755 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7756 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7757 | { 2, alc888_3st_hp_2ch_init }, |
| 7758 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7759 | }; |
| 7760 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7761 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7762 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7763 | { |
| 7764 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7765 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7766 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7767 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7768 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7769 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7770 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7771 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7772 | } |
| 7773 | |
| 7774 | /* toggle RCA according to the front-jack state */ |
| 7775 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7776 | { |
| 7777 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7778 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7779 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7780 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7781 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7782 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7783 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7784 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7785 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7786 | unsigned int res) |
| 7787 | { |
| 7788 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7789 | alc888_lenovo_ms7195_front_automute(codec); |
| 7790 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7791 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7792 | } |
| 7793 | |
| 7794 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7795 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7796 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7797 | |
| 7798 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7799 | |
| 7800 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7801 | { } /* end */ |
| 7802 | }; |
| 7803 | |
| 7804 | /* toggle speaker-output according to the hp-jack state */ |
| 7805 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7806 | { |
| 7807 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7808 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7809 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7810 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7811 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7812 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7813 | } |
| 7814 | |
| 7815 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7816 | unsigned int res) |
| 7817 | { |
| 7818 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7819 | alc883_medion_md2_automute(codec); |
| 7820 | } |
| 7821 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7822 | /* toggle speaker-output according to the hp-jack state */ |
| 7823 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7824 | { |
| 7825 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7826 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7827 | |
| 7828 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7829 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7830 | bits = present ? HDA_AMP_MUTE : 0; |
| 7831 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7832 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7833 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7834 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7835 | } |
| 7836 | |
| 7837 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7838 | { |
| 7839 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7840 | alc883_tagra_automute(codec); |
| 7841 | } |
| 7842 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7843 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7844 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7845 | { |
| 7846 | unsigned int present; |
| 7847 | unsigned char bits; |
| 7848 | |
| 7849 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7850 | & AC_PINSENSE_PRESENCE; |
| 7851 | bits = present ? HDA_AMP_MUTE : 0; |
| 7852 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7853 | HDA_AMP_MUTE, bits); |
| 7854 | } |
| 7855 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7856 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7857 | { |
| 7858 | unsigned int present; |
| 7859 | |
| 7860 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7861 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7862 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7863 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7864 | } |
| 7865 | |
| 7866 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7867 | { |
| 7868 | alc883_clevo_m720_hp_automute(codec); |
| 7869 | alc883_clevo_m720_mic_automute(codec); |
| 7870 | } |
| 7871 | |
| 7872 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7873 | unsigned int res) |
| 7874 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7875 | switch (res >> 26) { |
| 7876 | case ALC880_HP_EVENT: |
| 7877 | alc883_clevo_m720_hp_automute(codec); |
| 7878 | break; |
| 7879 | case ALC880_MIC_EVENT: |
| 7880 | alc883_clevo_m720_mic_automute(codec); |
| 7881 | break; |
| 7882 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7883 | } |
| 7884 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7885 | /* toggle speaker-output according to the hp-jack state */ |
| 7886 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7887 | { |
| 7888 | unsigned int present; |
| 7889 | unsigned char bits; |
| 7890 | |
| 7891 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7892 | & AC_PINSENSE_PRESENCE; |
| 7893 | bits = present ? HDA_AMP_MUTE : 0; |
| 7894 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7895 | HDA_AMP_MUTE, bits); |
| 7896 | } |
| 7897 | |
| 7898 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7899 | unsigned int res) |
| 7900 | { |
| 7901 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7902 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7903 | } |
| 7904 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7905 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7906 | { |
| 7907 | unsigned int present; |
| 7908 | unsigned char bits; |
| 7909 | |
| 7910 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7911 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7912 | bits = present ? 0x80 : 0; |
| 7913 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7914 | 0x80, bits); |
| 7915 | } |
| 7916 | |
| 7917 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7918 | unsigned int res) |
| 7919 | { |
| 7920 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7921 | alc883_haier_w66_automute(codec); |
| 7922 | } |
| 7923 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7924 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7925 | { |
| 7926 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7927 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7928 | |
| 7929 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7930 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7931 | bits = present ? HDA_AMP_MUTE : 0; |
| 7932 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7933 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7934 | } |
| 7935 | |
| 7936 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7937 | { |
| 7938 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7939 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7940 | |
| 7941 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7942 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7943 | bits = present ? HDA_AMP_MUTE : 0; |
| 7944 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7945 | HDA_AMP_MUTE, bits); |
| 7946 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7947 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7948 | } |
| 7949 | |
| 7950 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7951 | unsigned int res) |
| 7952 | { |
| 7953 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7954 | alc883_lenovo_101e_all_automute(codec); |
| 7955 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7956 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7957 | } |
| 7958 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7959 | /* toggle speaker-output according to the hp-jack state */ |
| 7960 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7961 | { |
| 7962 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7963 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7964 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7965 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7966 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7967 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7968 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7969 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7970 | } |
| 7971 | |
| 7972 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7973 | unsigned int res) |
| 7974 | { |
| 7975 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7976 | alc883_acer_aspire_automute(codec); |
| 7977 | } |
| 7978 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7979 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7980 | /* HP Pin: output 0 (0x0c) */ |
| 7981 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7982 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7983 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7984 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7985 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7986 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7987 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7988 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7989 | /* eanable EAPD on medion laptop */ |
| 7990 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7991 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7992 | /* enable unsolicited event */ |
| 7993 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7994 | { } |
| 7995 | }; |
| 7996 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7997 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7998 | { |
| 7999 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8000 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8001 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8002 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8003 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8004 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8005 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8006 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8007 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8008 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8009 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8010 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8011 | } |
| 8012 | |
| 8013 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 8014 | unsigned int res) |
| 8015 | { |
| 8016 | switch (res >> 26) { |
| 8017 | case ALC880_HP_EVENT: |
| 8018 | printk("hp_event\n"); |
| 8019 | alc888_6st_dell_front_automute(codec); |
| 8020 | break; |
| 8021 | } |
| 8022 | } |
| 8023 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8024 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 8025 | { |
| 8026 | unsigned int mute; |
| 8027 | unsigned int present; |
| 8028 | |
| 8029 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8030 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8031 | AC_VERB_GET_PIN_SENSE, 0); |
| 8032 | present = (present & 0x80000000) != 0; |
| 8033 | if (present) { |
| 8034 | /* mute internal speaker */ |
| 8035 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8036 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8037 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8038 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8039 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8040 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8041 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8042 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8043 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8044 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8045 | } else { |
| 8046 | /* unmute internal speaker if necessary */ |
| 8047 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8048 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8049 | HDA_AMP_MUTE, mute); |
| 8050 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8051 | HDA_AMP_MUTE, mute); |
| 8052 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8053 | HDA_AMP_MUTE, mute); |
| 8054 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8055 | HDA_AMP_MUTE, mute); |
| 8056 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8057 | HDA_AMP_MUTE, mute); |
| 8058 | } |
| 8059 | } |
| 8060 | |
| 8061 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 8062 | unsigned int res) |
| 8063 | { |
| 8064 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8065 | alc888_lenovo_sky_front_automute(codec); |
| 8066 | } |
| 8067 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8068 | /* |
| 8069 | * generic initialization of ADC, input mixers and output mixers |
| 8070 | */ |
| 8071 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8072 | /* |
| 8073 | * Unmute ADC0-2 and set the default input to mic-in |
| 8074 | */ |
| 8075 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8076 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8077 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8078 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8079 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8080 | /* 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] | 8081 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8082 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8083 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8084 | */ |
| 8085 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8086 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8087 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8088 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8089 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8090 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8091 | |
| 8092 | /* |
| 8093 | * Set up output mixers (0x0c - 0x0f) |
| 8094 | */ |
| 8095 | /* set vol=0 to output mixers */ |
| 8096 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8097 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8098 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8099 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8100 | /* set up input amps for analog loopback */ |
| 8101 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8103 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8104 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8105 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8106 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8107 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8108 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8109 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8110 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8111 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8112 | |
| 8113 | /* FIXME: use matrix-type input source selection */ |
| 8114 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8115 | /* Input mixer1 */ |
| 8116 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8117 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8118 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8119 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8120 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8121 | /* Input mixer2 */ |
| 8122 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8123 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8124 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8125 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8126 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8127 | |
| 8128 | { } |
| 8129 | }; |
| 8130 | |
| 8131 | /* capture mixer elements */ |
| 8132 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 8133 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8134 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8135 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 8136 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 8137 | { |
| 8138 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8139 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8140 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8141 | */ |
| 8142 | /* .name = "Capture Source", */ |
| 8143 | .name = "Input Source", |
| 8144 | .count = 2, |
| 8145 | .info = alc882_mux_enum_info, |
| 8146 | .get = alc882_mux_enum_get, |
| 8147 | .put = alc882_mux_enum_put, |
| 8148 | }, |
| 8149 | { } /* end */ |
| 8150 | }; |
| 8151 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8152 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8153 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8154 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8155 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8156 | /* enable unsolicited event */ |
| 8157 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8158 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8159 | { } /* end */ |
| 8160 | }; |
| 8161 | |
| 8162 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8163 | { |
| 8164 | unsigned int present; |
| 8165 | |
| 8166 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8167 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8168 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8169 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8170 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8171 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8172 | } |
| 8173 | |
| 8174 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8175 | { |
| 8176 | unsigned int present; |
| 8177 | unsigned char bits; |
| 8178 | |
| 8179 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8180 | AC_VERB_GET_PIN_SENSE, 0) |
| 8181 | & AC_PINSENSE_PRESENCE; |
| 8182 | bits = present ? 0 : PIN_OUT; |
| 8183 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8184 | bits); |
| 8185 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8186 | bits); |
| 8187 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8188 | bits); |
| 8189 | } |
| 8190 | |
| 8191 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8192 | unsigned int res) |
| 8193 | { |
| 8194 | switch (res >> 26) { |
| 8195 | case ALC880_HP_EVENT: |
| 8196 | alc883_M90V_speaker_automute(codec); |
| 8197 | break; |
| 8198 | case ALC880_MIC_EVENT: |
| 8199 | alc883_nb_mic_automute(codec); |
| 8200 | break; |
| 8201 | } |
| 8202 | } |
| 8203 | |
| 8204 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8205 | { |
| 8206 | alc883_M90V_speaker_automute(codec); |
| 8207 | alc883_nb_mic_automute(codec); |
| 8208 | } |
| 8209 | |
| 8210 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8211 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8212 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8213 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8214 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8215 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8216 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8217 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8218 | /* enable unsolicited event */ |
| 8219 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8220 | { } /* end */ |
| 8221 | }; |
| 8222 | |
| 8223 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8224 | { |
| 8225 | unsigned int present; |
| 8226 | unsigned char bits; |
| 8227 | |
| 8228 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8229 | AC_VERB_GET_PIN_SENSE, 0) |
| 8230 | & AC_PINSENSE_PRESENCE; |
| 8231 | bits = present ? 0 : PIN_OUT; |
| 8232 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8233 | bits); |
| 8234 | } |
| 8235 | |
| 8236 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8237 | unsigned int res) |
| 8238 | { |
| 8239 | switch (res >> 26) { |
| 8240 | case ALC880_HP_EVENT: |
| 8241 | alc883_eee1601_speaker_automute(codec); |
| 8242 | break; |
| 8243 | } |
| 8244 | } |
| 8245 | |
| 8246 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8247 | { |
| 8248 | alc883_eee1601_speaker_automute(codec); |
| 8249 | } |
| 8250 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8251 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8252 | #define alc883_loopbacks alc880_loopbacks |
| 8253 | #endif |
| 8254 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8255 | /* pcm configuration: identiacal with ALC880 */ |
| 8256 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8257 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8258 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8259 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8260 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8261 | |
| 8262 | /* |
| 8263 | * configuration and preset |
| 8264 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8265 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8266 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8267 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8268 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8269 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8270 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8271 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8272 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8273 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8274 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8275 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8276 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8277 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8278 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8279 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8280 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8281 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8282 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8283 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8284 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8285 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8286 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8287 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8288 | [ALC883_AUTO] = "auto", |
| 8289 | }; |
| 8290 | |
| 8291 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8292 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8293 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 8294 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8295 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8296 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8297 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8298 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8299 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8300 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8301 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8302 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8303 | 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] | 8304 | SND_PCI_QUIRK(0x1043, 0x8317, "Asus M90V", ALC888_ASUS_M90V), |
| 8305 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8306 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8307 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8308 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8309 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8310 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8311 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8312 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8313 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8314 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8315 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8316 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8317 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8318 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8319 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8320 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8321 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8322 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8323 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8324 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8325 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8326 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8327 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8328 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8329 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8330 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8331 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8332 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8333 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8334 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8335 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8336 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8337 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8338 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8339 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8340 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8341 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8342 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8343 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8344 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8345 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8346 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8347 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8348 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8349 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8350 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8351 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8352 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8353 | {} |
| 8354 | }; |
| 8355 | |
| 8356 | static struct alc_config_preset alc883_presets[] = { |
| 8357 | [ALC883_3ST_2ch_DIG] = { |
| 8358 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8359 | .init_verbs = { alc883_init_verbs }, |
| 8360 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8361 | .dac_nids = alc883_dac_nids, |
| 8362 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8363 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8364 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8365 | .channel_mode = alc883_3ST_2ch_modes, |
| 8366 | .input_mux = &alc883_capture_source, |
| 8367 | }, |
| 8368 | [ALC883_3ST_6ch_DIG] = { |
| 8369 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8370 | .init_verbs = { alc883_init_verbs }, |
| 8371 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8372 | .dac_nids = alc883_dac_nids, |
| 8373 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8374 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8375 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8376 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8377 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8378 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8379 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8380 | [ALC883_3ST_6ch] = { |
| 8381 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8382 | .init_verbs = { alc883_init_verbs }, |
| 8383 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8384 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8385 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8386 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8387 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8388 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8389 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8390 | [ALC883_3ST_6ch_INTEL] = { |
| 8391 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8392 | .init_verbs = { alc883_init_verbs }, |
| 8393 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8394 | .dac_nids = alc883_dac_nids, |
| 8395 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8396 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8397 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8398 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8399 | .need_dac_fix = 1, |
| 8400 | .input_mux = &alc883_3stack_6ch_intel, |
| 8401 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8402 | [ALC883_6ST_DIG] = { |
| 8403 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8404 | .init_verbs = { alc883_init_verbs }, |
| 8405 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8406 | .dac_nids = alc883_dac_nids, |
| 8407 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8408 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8409 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8410 | .channel_mode = alc883_sixstack_modes, |
| 8411 | .input_mux = &alc883_capture_source, |
| 8412 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8413 | [ALC883_TARGA_DIG] = { |
| 8414 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8415 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8416 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8417 | .dac_nids = alc883_dac_nids, |
| 8418 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8419 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8420 | .channel_mode = alc883_3ST_6ch_modes, |
| 8421 | .need_dac_fix = 1, |
| 8422 | .input_mux = &alc883_capture_source, |
| 8423 | .unsol_event = alc883_tagra_unsol_event, |
| 8424 | .init_hook = alc883_tagra_automute, |
| 8425 | }, |
| 8426 | [ALC883_TARGA_2ch_DIG] = { |
| 8427 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8428 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8429 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8430 | .dac_nids = alc883_dac_nids, |
| 8431 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8432 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8433 | .channel_mode = alc883_3ST_2ch_modes, |
| 8434 | .input_mux = &alc883_capture_source, |
| 8435 | .unsol_event = alc883_tagra_unsol_event, |
| 8436 | .init_hook = alc883_tagra_automute, |
| 8437 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8438 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8439 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8440 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8441 | * and the headphone jack. Turn this on and rely on the |
| 8442 | * standard mute methods whenever the user wants to turn |
| 8443 | * these outputs off. |
| 8444 | */ |
| 8445 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8446 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8447 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8448 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8449 | .channel_mode = alc883_3ST_2ch_modes, |
| 8450 | .input_mux = &alc883_capture_source, |
| 8451 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8452 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8453 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8454 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8455 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8456 | .dac_nids = alc883_dac_nids, |
| 8457 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8458 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8459 | .channel_mode = alc883_3ST_2ch_modes, |
| 8460 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8461 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8462 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8463 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8464 | [ALC883_MEDION] = { |
| 8465 | .mixers = { alc883_fivestack_mixer, |
| 8466 | alc883_chmode_mixer }, |
| 8467 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8468 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8469 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8470 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8471 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8472 | .channel_mode = alc883_sixstack_modes, |
| 8473 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8474 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8475 | [ALC883_MEDION_MD2] = { |
| 8476 | .mixers = { alc883_medion_md2_mixer}, |
| 8477 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8478 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8479 | .dac_nids = alc883_dac_nids, |
| 8480 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8481 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8482 | .channel_mode = alc883_3ST_2ch_modes, |
| 8483 | .input_mux = &alc883_capture_source, |
| 8484 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8485 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8486 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8487 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8488 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8489 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8490 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8491 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8492 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8493 | .channel_mode = alc883_3ST_2ch_modes, |
| 8494 | .input_mux = &alc883_capture_source, |
| 8495 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8496 | [ALC883_CLEVO_M720] = { |
| 8497 | .mixers = { alc883_clevo_m720_mixer }, |
| 8498 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8499 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8500 | .dac_nids = alc883_dac_nids, |
| 8501 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8502 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8503 | .channel_mode = alc883_3ST_2ch_modes, |
| 8504 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8505 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8506 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8507 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8508 | [ALC883_LENOVO_101E_2ch] = { |
| 8509 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8510 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8511 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8512 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8513 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8514 | .channel_mode = alc883_3ST_2ch_modes, |
| 8515 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8516 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8517 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8518 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8519 | [ALC883_LENOVO_NB0763] = { |
| 8520 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8521 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8522 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8523 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8524 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8525 | .channel_mode = alc883_3ST_2ch_modes, |
| 8526 | .need_dac_fix = 1, |
| 8527 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8528 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8529 | .init_hook = alc883_medion_md2_automute, |
| 8530 | }, |
| 8531 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8532 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8533 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8534 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8535 | .dac_nids = alc883_dac_nids, |
| 8536 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8537 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8538 | .channel_mode = alc883_3ST_6ch_modes, |
| 8539 | .need_dac_fix = 1, |
| 8540 | .input_mux = &alc883_capture_source, |
| 8541 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8542 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8543 | }, |
| 8544 | [ALC883_HAIER_W66] = { |
| 8545 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8546 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8547 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8548 | .dac_nids = alc883_dac_nids, |
| 8549 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8550 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8551 | .channel_mode = alc883_3ST_2ch_modes, |
| 8552 | .input_mux = &alc883_capture_source, |
| 8553 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8554 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8555 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8556 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8557 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8558 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8559 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8560 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8561 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8562 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8563 | .need_dac_fix = 1, |
| 8564 | .input_mux = &alc883_capture_source, |
| 8565 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8566 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8567 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8568 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8569 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8570 | .dac_nids = alc883_dac_nids, |
| 8571 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8572 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8573 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8574 | .channel_mode = alc883_sixstack_modes, |
| 8575 | .input_mux = &alc883_capture_source, |
| 8576 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8577 | .init_hook = alc888_6st_dell_front_automute, |
| 8578 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8579 | [ALC883_MITAC] = { |
| 8580 | .mixers = { alc883_mitac_mixer }, |
| 8581 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8582 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8583 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8584 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8585 | .channel_mode = alc883_3ST_2ch_modes, |
| 8586 | .input_mux = &alc883_capture_source, |
| 8587 | .unsol_event = alc883_mitac_unsol_event, |
| 8588 | .init_hook = alc883_mitac_automute, |
| 8589 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8590 | [ALC883_FUJITSU_PI2515] = { |
| 8591 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8592 | .init_verbs = { alc883_init_verbs, |
| 8593 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8594 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8595 | .dac_nids = alc883_dac_nids, |
| 8596 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8597 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8598 | .channel_mode = alc883_3ST_2ch_modes, |
| 8599 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8600 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8601 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8602 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8603 | [ALC888_LENOVO_SKY] = { |
| 8604 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 8605 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 8606 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8607 | .dac_nids = alc883_dac_nids, |
| 8608 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8609 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 8610 | .adc_nids = alc883_adc_nids, |
| 8611 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8612 | .channel_mode = alc883_sixstack_modes, |
| 8613 | .need_dac_fix = 1, |
| 8614 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 8615 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 8616 | .init_hook = alc888_lenovo_sky_front_automute, |
| 8617 | }, |
| 8618 | [ALC888_ASUS_M90V] = { |
| 8619 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8620 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 8621 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8622 | .dac_nids = alc883_dac_nids, |
| 8623 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8624 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8625 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8626 | .channel_mode = alc883_3ST_6ch_modes, |
| 8627 | .need_dac_fix = 1, |
| 8628 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8629 | .unsol_event = alc883_mode2_unsol_event, |
| 8630 | .init_hook = alc883_mode2_inithook, |
| 8631 | }, |
| 8632 | [ALC888_ASUS_EEE1601] = { |
| 8633 | .mixers = { alc883_asus_eee1601_mixer }, |
| 8634 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 8635 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8636 | .dac_nids = alc883_dac_nids, |
| 8637 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8638 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8639 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8640 | .channel_mode = alc883_3ST_2ch_modes, |
| 8641 | .need_dac_fix = 1, |
| 8642 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 8643 | .unsol_event = alc883_eee1601_unsol_event, |
| 8644 | .init_hook = alc883_eee1601_inithook, |
| 8645 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8646 | }; |
| 8647 | |
| 8648 | |
| 8649 | /* |
| 8650 | * BIOS auto configuration |
| 8651 | */ |
| 8652 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8653 | hda_nid_t nid, int pin_type, |
| 8654 | int dac_idx) |
| 8655 | { |
| 8656 | /* set as output */ |
| 8657 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8658 | int idx; |
| 8659 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8660 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8661 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8662 | idx = 4; |
| 8663 | else |
| 8664 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8665 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8666 | |
| 8667 | } |
| 8668 | |
| 8669 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8670 | { |
| 8671 | struct alc_spec *spec = codec->spec; |
| 8672 | int i; |
| 8673 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8674 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8675 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8676 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8677 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8678 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8679 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8680 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8681 | } |
| 8682 | } |
| 8683 | |
| 8684 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8685 | { |
| 8686 | struct alc_spec *spec = codec->spec; |
| 8687 | hda_nid_t pin; |
| 8688 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8689 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8690 | if (pin) /* connect to front */ |
| 8691 | /* use dac 0 */ |
| 8692 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8693 | pin = spec->autocfg.speaker_pins[0]; |
| 8694 | if (pin) |
| 8695 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8696 | } |
| 8697 | |
| 8698 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8699 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8700 | |
| 8701 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8702 | { |
| 8703 | struct alc_spec *spec = codec->spec; |
| 8704 | int i; |
| 8705 | |
| 8706 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8707 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8708 | if (alc883_is_input_pin(nid)) { |
| 8709 | snd_hda_codec_write(codec, nid, 0, |
| 8710 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8711 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8712 | PIN_VREF80 : PIN_IN)); |
| 8713 | if (nid != ALC883_PIN_CD_NID) |
| 8714 | snd_hda_codec_write(codec, nid, 0, |
| 8715 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8716 | AMP_OUT_MUTE); |
| 8717 | } |
| 8718 | } |
| 8719 | } |
| 8720 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8721 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 8722 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8723 | /* almost identical with ALC880 parser... */ |
| 8724 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8725 | { |
| 8726 | struct alc_spec *spec = codec->spec; |
| 8727 | int err = alc880_parse_auto_config(codec); |
| 8728 | |
| 8729 | if (err < 0) |
| 8730 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8731 | else if (!err) |
| 8732 | return 0; /* no config found */ |
| 8733 | |
| 8734 | err = alc_auto_add_mic_boost(codec); |
| 8735 | if (err < 0) |
| 8736 | return err; |
| 8737 | |
| 8738 | /* hack - override the init verbs */ |
| 8739 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8740 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8741 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8742 | |
| 8743 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8744 | } |
| 8745 | |
| 8746 | /* additional initialization for auto-configuration model */ |
| 8747 | static void alc883_auto_init(struct hda_codec *codec) |
| 8748 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8749 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8750 | alc883_auto_init_multi_out(codec); |
| 8751 | alc883_auto_init_hp_out(codec); |
| 8752 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8753 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8754 | if (spec->unsol_event) |
| 8755 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8756 | } |
| 8757 | |
| 8758 | static int patch_alc883(struct hda_codec *codec) |
| 8759 | { |
| 8760 | struct alc_spec *spec; |
| 8761 | int err, board_config; |
| 8762 | |
| 8763 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8764 | if (spec == NULL) |
| 8765 | return -ENOMEM; |
| 8766 | |
| 8767 | codec->spec = spec; |
| 8768 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 8769 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 8770 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8771 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8772 | alc883_models, |
| 8773 | alc883_cfg_tbl); |
| 8774 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8775 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8776 | "trying auto-probe from BIOS...\n"); |
| 8777 | board_config = ALC883_AUTO; |
| 8778 | } |
| 8779 | |
| 8780 | if (board_config == ALC883_AUTO) { |
| 8781 | /* automatic parse from the BIOS config */ |
| 8782 | err = alc883_parse_auto_config(codec); |
| 8783 | if (err < 0) { |
| 8784 | alc_free(codec); |
| 8785 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8786 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8787 | printk(KERN_INFO |
| 8788 | "hda_codec: Cannot set up configuration " |
| 8789 | "from BIOS. Using base mode...\n"); |
| 8790 | board_config = ALC883_3ST_2ch_DIG; |
| 8791 | } |
| 8792 | } |
| 8793 | |
| 8794 | if (board_config != ALC883_AUTO) |
| 8795 | setup_preset(spec, &alc883_presets[board_config]); |
| 8796 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8797 | switch (codec->vendor_id) { |
| 8798 | case 0x10ec0888: |
| 8799 | spec->stream_name_analog = "ALC888 Analog"; |
| 8800 | spec->stream_name_digital = "ALC888 Digital"; |
| 8801 | break; |
| 8802 | case 0x10ec0889: |
| 8803 | spec->stream_name_analog = "ALC889 Analog"; |
| 8804 | spec->stream_name_digital = "ALC889 Digital"; |
| 8805 | break; |
| 8806 | default: |
| 8807 | spec->stream_name_analog = "ALC883 Analog"; |
| 8808 | spec->stream_name_digital = "ALC883 Digital"; |
| 8809 | break; |
| 8810 | } |
| 8811 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8812 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8813 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8814 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8815 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8816 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8817 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8818 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8819 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8820 | spec->adc_nids = alc883_adc_nids; |
| 8821 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8822 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8823 | spec->vmaster_nid = 0x0c; |
| 8824 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8825 | codec->patch_ops = alc_patch_ops; |
| 8826 | if (board_config == ALC883_AUTO) |
| 8827 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 8828 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8829 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8830 | if (!spec->loopback.amplist) |
| 8831 | spec->loopback.amplist = alc883_loopbacks; |
| 8832 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8833 | |
| 8834 | return 0; |
| 8835 | } |
| 8836 | |
| 8837 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8838 | * ALC262 support |
| 8839 | */ |
| 8840 | |
| 8841 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8842 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8843 | |
| 8844 | #define alc262_dac_nids alc260_dac_nids |
| 8845 | #define alc262_adc_nids alc882_adc_nids |
| 8846 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8847 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8848 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8849 | |
| 8850 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8851 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8852 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 8853 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 8854 | /* ADC0 */ |
| 8855 | 0x09 |
| 8856 | }; |
| 8857 | |
| 8858 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 8859 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8860 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8861 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8862 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8863 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8864 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8865 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8866 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8869 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8870 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8871 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8872 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8873 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8874 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8875 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8876 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8877 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8878 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8879 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8880 | }; |
| 8881 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8882 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8883 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8884 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8885 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8886 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8887 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8888 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8889 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8890 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8891 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8892 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8893 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8894 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8895 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8896 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8897 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8898 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8899 | { } /* end */ |
| 8900 | }; |
| 8901 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8902 | /* update HP, line and mono-out pins according to the master switch */ |
| 8903 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8904 | { |
| 8905 | struct alc_spec *spec = codec->spec; |
| 8906 | int val = spec->master_sw; |
| 8907 | |
| 8908 | /* HP & line-out */ |
| 8909 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8910 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8911 | val ? PIN_HP : 0); |
| 8912 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8913 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8914 | val ? PIN_HP : 0); |
| 8915 | /* mono (speaker) depending on the HP jack sense */ |
| 8916 | val = val && !spec->jack_present; |
| 8917 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8918 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8919 | val ? PIN_OUT : 0); |
| 8920 | } |
| 8921 | |
| 8922 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8923 | { |
| 8924 | struct alc_spec *spec = codec->spec; |
| 8925 | unsigned int presence; |
| 8926 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8927 | AC_VERB_GET_PIN_SENSE, 0); |
| 8928 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8929 | alc262_hp_master_update(codec); |
| 8930 | } |
| 8931 | |
| 8932 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8933 | { |
| 8934 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8935 | return; |
| 8936 | alc262_hp_bpc_automute(codec); |
| 8937 | } |
| 8938 | |
| 8939 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8940 | { |
| 8941 | struct alc_spec *spec = codec->spec; |
| 8942 | unsigned int presence; |
| 8943 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8944 | AC_VERB_GET_PIN_SENSE, 0); |
| 8945 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8946 | alc262_hp_master_update(codec); |
| 8947 | } |
| 8948 | |
| 8949 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8950 | unsigned int res) |
| 8951 | { |
| 8952 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8953 | return; |
| 8954 | alc262_hp_wildwest_automute(codec); |
| 8955 | } |
| 8956 | |
| 8957 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8958 | struct snd_ctl_elem_value *ucontrol) |
| 8959 | { |
| 8960 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8961 | struct alc_spec *spec = codec->spec; |
| 8962 | *ucontrol->value.integer.value = spec->master_sw; |
| 8963 | return 0; |
| 8964 | } |
| 8965 | |
| 8966 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8967 | struct snd_ctl_elem_value *ucontrol) |
| 8968 | { |
| 8969 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8970 | struct alc_spec *spec = codec->spec; |
| 8971 | int val = !!*ucontrol->value.integer.value; |
| 8972 | |
| 8973 | if (val == spec->master_sw) |
| 8974 | return 0; |
| 8975 | spec->master_sw = val; |
| 8976 | alc262_hp_master_update(codec); |
| 8977 | return 1; |
| 8978 | } |
| 8979 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8980 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8981 | { |
| 8982 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8983 | .name = "Master Playback Switch", |
| 8984 | .info = snd_ctl_boolean_mono_info, |
| 8985 | .get = alc262_hp_master_sw_get, |
| 8986 | .put = alc262_hp_master_sw_put, |
| 8987 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8988 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8989 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8990 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8991 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8992 | HDA_OUTPUT), |
| 8993 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8994 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8995 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8996 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8997 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8998 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8999 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9000 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9001 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9002 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9003 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9004 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9005 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9006 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9007 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9008 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9009 | { } /* end */ |
| 9010 | }; |
| 9011 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9012 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9013 | { |
| 9014 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9015 | .name = "Master Playback Switch", |
| 9016 | .info = snd_ctl_boolean_mono_info, |
| 9017 | .get = alc262_hp_master_sw_get, |
| 9018 | .put = alc262_hp_master_sw_put, |
| 9019 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9020 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9021 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9022 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9023 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9024 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9025 | HDA_OUTPUT), |
| 9026 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9027 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9028 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9029 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9030 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9031 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9032 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9033 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9034 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9035 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9036 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9037 | { } /* end */ |
| 9038 | }; |
| 9039 | |
| 9040 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9041 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9042 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9043 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9044 | { } /* end */ |
| 9045 | }; |
| 9046 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9047 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9048 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 9049 | { |
| 9050 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9051 | |
| 9052 | if (force || !spec->sense_updated) { |
| 9053 | unsigned int present; |
| 9054 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9055 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9056 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9057 | spec->sense_updated = 1; |
| 9058 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9059 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 9060 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9061 | } |
| 9062 | |
| 9063 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9064 | unsigned int res) |
| 9065 | { |
| 9066 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9067 | return; |
| 9068 | alc262_hp_t5735_automute(codec, 1); |
| 9069 | } |
| 9070 | |
| 9071 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9072 | { |
| 9073 | alc262_hp_t5735_automute(codec, 1); |
| 9074 | } |
| 9075 | |
| 9076 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9077 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9078 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9079 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9080 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9081 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9082 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9083 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9084 | { } /* end */ |
| 9085 | }; |
| 9086 | |
| 9087 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9088 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9089 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9090 | |
| 9091 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9092 | { } |
| 9093 | }; |
| 9094 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9095 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9096 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9097 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9098 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9099 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9100 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9101 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9102 | { } /* end */ |
| 9103 | }; |
| 9104 | |
| 9105 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9106 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9107 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9108 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9109 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9110 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9111 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9112 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9113 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9114 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9115 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9116 | {} |
| 9117 | }; |
| 9118 | |
| 9119 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9120 | .num_items = 1, |
| 9121 | .items = { |
| 9122 | { "Line", 0x1 }, |
| 9123 | }, |
| 9124 | }; |
| 9125 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9126 | /* bind hp and internal speaker mute (with plug check) */ |
| 9127 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9128 | struct snd_ctl_elem_value *ucontrol) |
| 9129 | { |
| 9130 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9131 | long *valp = ucontrol->value.integer.value; |
| 9132 | int change; |
| 9133 | |
| 9134 | /* change hp mute */ |
| 9135 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9136 | HDA_AMP_MUTE, |
| 9137 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9138 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9139 | HDA_AMP_MUTE, |
| 9140 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9141 | if (change) { |
| 9142 | /* change speaker according to HP jack state */ |
| 9143 | struct alc_spec *spec = codec->spec; |
| 9144 | unsigned int mute; |
| 9145 | if (spec->jack_present) |
| 9146 | mute = HDA_AMP_MUTE; |
| 9147 | else |
| 9148 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9149 | HDA_OUTPUT, 0); |
| 9150 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9151 | HDA_AMP_MUTE, mute); |
| 9152 | } |
| 9153 | return change; |
| 9154 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9155 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9156 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9157 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9158 | { |
| 9159 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9160 | .name = "Master Playback Switch", |
| 9161 | .info = snd_hda_mixer_amp_switch_info, |
| 9162 | .get = snd_hda_mixer_amp_switch_get, |
| 9163 | .put = alc262_sony_master_sw_put, |
| 9164 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9165 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9166 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9167 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9168 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9169 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9170 | { } /* end */ |
| 9171 | }; |
| 9172 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9173 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9174 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9175 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9176 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9177 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9179 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9180 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9181 | { } /* end */ |
| 9182 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9183 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9184 | #define alc262_capture_mixer alc882_capture_mixer |
| 9185 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9186 | |
| 9187 | /* |
| 9188 | * generic initialization of ADC, input mixers and output mixers |
| 9189 | */ |
| 9190 | static struct hda_verb alc262_init_verbs[] = { |
| 9191 | /* |
| 9192 | * Unmute ADC0-2 and set the default input to mic-in |
| 9193 | */ |
| 9194 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9195 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9196 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9197 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9198 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9199 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9200 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9201 | /* 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] | 9202 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9203 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9204 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9205 | */ |
| 9206 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9207 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9208 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9209 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9210 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9211 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9212 | |
| 9213 | /* |
| 9214 | * Set up output mixers (0x0c - 0x0e) |
| 9215 | */ |
| 9216 | /* set vol=0 to output mixers */ |
| 9217 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9218 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9219 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9220 | /* set up input amps for analog loopback */ |
| 9221 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9222 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9223 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9224 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9225 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9226 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9227 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9228 | |
| 9229 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9230 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9231 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9232 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9233 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9234 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9235 | |
| 9236 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9238 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9239 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9240 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9241 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9242 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9243 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9244 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9245 | /* FIXME: use matrix-type input source selection */ |
| 9246 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9247 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9248 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9249 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9250 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9251 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9252 | /* Input mixer2 */ |
| 9253 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9254 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9255 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9256 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9257 | /* Input mixer3 */ |
| 9258 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9259 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9260 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9261 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9262 | |
| 9263 | { } |
| 9264 | }; |
| 9265 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9266 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9267 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9268 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9269 | { } |
| 9270 | }; |
| 9271 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9272 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9273 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9274 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9275 | {} |
| 9276 | }; |
| 9277 | |
| 9278 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9279 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9280 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9281 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9282 | |
| 9283 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9284 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9285 | {} |
| 9286 | }; |
| 9287 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9288 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9289 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9290 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9291 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9292 | |
| 9293 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9294 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9295 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9296 | }; |
| 9297 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9298 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9299 | .num_items = 2, |
| 9300 | .items = { |
| 9301 | { "Int DMic", 0x9 }, |
| 9302 | { "Mic", 0x0 }, |
| 9303 | }, |
| 9304 | }; |
| 9305 | |
| 9306 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9307 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9308 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9309 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9310 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9311 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9312 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9313 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9314 | { |
| 9315 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9316 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9317 | * So call somewhat different.. |
| 9318 | */ |
| 9319 | /* .name = "Capture Source", */ |
| 9320 | .name = "Input Source", |
| 9321 | .count = 1, |
| 9322 | .info = alc_mux_enum_info, |
| 9323 | .get = alc_mux_enum_get, |
| 9324 | .put = alc_mux_enum_put, |
| 9325 | }, |
| 9326 | { } /* end */ |
| 9327 | }; |
| 9328 | |
| 9329 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9330 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9331 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9332 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9333 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9334 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9335 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9336 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9337 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9338 | {} |
| 9339 | }; |
| 9340 | |
| 9341 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9342 | { |
| 9343 | unsigned int present; |
| 9344 | |
| 9345 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9346 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9347 | snd_hda_codec_write(codec, 0x22, 0, |
| 9348 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9349 | } |
| 9350 | |
| 9351 | /* toggle speaker-output according to the hp-jack state */ |
| 9352 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9353 | { |
| 9354 | unsigned int present; |
| 9355 | unsigned char bits; |
| 9356 | |
| 9357 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9358 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9359 | bits = present ? 0 : PIN_OUT; |
| 9360 | snd_hda_codec_write(codec, 0x14, 0, |
| 9361 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9362 | } |
| 9363 | |
| 9364 | |
| 9365 | |
| 9366 | /* unsolicited event for HP jack sensing */ |
| 9367 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9368 | unsigned int res) |
| 9369 | { |
| 9370 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9371 | alc262_toshiba_s06_speaker_automute(codec); |
| 9372 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9373 | alc262_dmic_automute(codec); |
| 9374 | |
| 9375 | } |
| 9376 | |
| 9377 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9378 | { |
| 9379 | alc262_toshiba_s06_speaker_automute(codec); |
| 9380 | alc262_dmic_automute(codec); |
| 9381 | } |
| 9382 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9383 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9384 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9385 | { |
| 9386 | struct alc_spec *spec = codec->spec; |
| 9387 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9388 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9389 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9390 | /* need to execute and sync at first */ |
| 9391 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9392 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9393 | AC_VERB_GET_PIN_SENSE, 0); |
| 9394 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9395 | if (spec->jack_present) { |
| 9396 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9397 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9398 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9399 | } else { |
| 9400 | /* unmute internal speaker if necessary */ |
| 9401 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9402 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9403 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9404 | } |
| 9405 | } |
| 9406 | |
| 9407 | /* unsolicited event for HP jack sensing */ |
| 9408 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9409 | unsigned int res) |
| 9410 | { |
| 9411 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9412 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9413 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9414 | } |
| 9415 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9416 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9417 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9418 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9419 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9420 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9421 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9422 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9423 | AC_VERB_GET_PIN_SENSE, 0); |
| 9424 | present = (present & 0x80000000) != 0; |
| 9425 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9426 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9427 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9428 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9429 | } else { |
| 9430 | /* unmute internal speaker if necessary */ |
| 9431 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9432 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9433 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9434 | } |
| 9435 | } |
| 9436 | |
| 9437 | /* unsolicited event for HP jack sensing */ |
| 9438 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9439 | unsigned int res) |
| 9440 | { |
| 9441 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9442 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9443 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9444 | } |
| 9445 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9446 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9447 | * nec model |
| 9448 | * 0x15 = headphone |
| 9449 | * 0x16 = internal speaker |
| 9450 | * 0x18 = external mic |
| 9451 | */ |
| 9452 | |
| 9453 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9454 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9455 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9456 | |
| 9457 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9458 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9459 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9460 | |
| 9461 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9462 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9463 | { } /* end */ |
| 9464 | }; |
| 9465 | |
| 9466 | static struct hda_verb alc262_nec_verbs[] = { |
| 9467 | /* Unmute Speaker */ |
| 9468 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9469 | |
| 9470 | /* Headphone */ |
| 9471 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9472 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9473 | |
| 9474 | /* External mic to headphone */ |
| 9475 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9476 | /* External mic to speaker */ |
| 9477 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9478 | {} |
| 9479 | }; |
| 9480 | |
| 9481 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9482 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9483 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9484 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9485 | */ |
| 9486 | |
| 9487 | #define ALC_HP_EVENT 0x37 |
| 9488 | |
| 9489 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9490 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9491 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9492 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9493 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9494 | {} |
| 9495 | }; |
| 9496 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9497 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9498 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9499 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9500 | {} |
| 9501 | }; |
| 9502 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9503 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9504 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9505 | .items = { |
| 9506 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9507 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9508 | { "CD", 0x4 }, |
| 9509 | }, |
| 9510 | }; |
| 9511 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9512 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9513 | .num_items = 5, |
| 9514 | .items = { |
| 9515 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9516 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9517 | { "Line", 0x2 }, |
| 9518 | { "CD", 0x4 }, |
| 9519 | { "AUX IN", 0x6 }, |
| 9520 | }, |
| 9521 | }; |
| 9522 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9523 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9524 | .num_items = 4, |
| 9525 | .items = { |
| 9526 | { "Mic", 0x0 }, |
| 9527 | { "Front Mic", 0x2 }, |
| 9528 | { "Line", 0x1 }, |
| 9529 | { "CD", 0x4 }, |
| 9530 | }, |
| 9531 | }; |
| 9532 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9533 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9534 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9535 | { |
| 9536 | struct alc_spec *spec = codec->spec; |
| 9537 | unsigned int mute; |
| 9538 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9539 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9540 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9541 | /* need to execute and sync at first */ |
| 9542 | 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] | 9543 | /* check laptop HP jack */ |
| 9544 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9545 | AC_VERB_GET_PIN_SENSE, 0); |
| 9546 | /* need to execute and sync at first */ |
| 9547 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9548 | /* check docking HP jack */ |
| 9549 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9550 | AC_VERB_GET_PIN_SENSE, 0); |
| 9551 | if (present & AC_PINSENSE_PRESENCE) |
| 9552 | spec->jack_present = 1; |
| 9553 | else |
| 9554 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9555 | spec->sense_updated = 1; |
| 9556 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9557 | /* unmute internal speaker only if both HPs are unplugged and |
| 9558 | * master switch is on |
| 9559 | */ |
| 9560 | if (spec->jack_present) |
| 9561 | mute = HDA_AMP_MUTE; |
| 9562 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9563 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9564 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9565 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9566 | } |
| 9567 | |
| 9568 | /* unsolicited event for HP jack sensing */ |
| 9569 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9570 | unsigned int res) |
| 9571 | { |
| 9572 | if ((res >> 26) != ALC_HP_EVENT) |
| 9573 | return; |
| 9574 | alc262_fujitsu_automute(codec, 1); |
| 9575 | } |
| 9576 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9577 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9578 | { |
| 9579 | alc262_fujitsu_automute(codec, 1); |
| 9580 | } |
| 9581 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9582 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9583 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 9584 | .ops = &snd_hda_bind_vol, |
| 9585 | .values = { |
| 9586 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 9587 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 9588 | 0 |
| 9589 | }, |
| 9590 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9591 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9592 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9593 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 9594 | { |
| 9595 | struct alc_spec *spec = codec->spec; |
| 9596 | unsigned int mute; |
| 9597 | |
| 9598 | if (force || !spec->sense_updated) { |
| 9599 | unsigned int present_int_hp; |
| 9600 | /* need to execute and sync at first */ |
| 9601 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9602 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 9603 | AC_VERB_GET_PIN_SENSE, 0); |
| 9604 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 9605 | spec->sense_updated = 1; |
| 9606 | } |
| 9607 | if (spec->jack_present) { |
| 9608 | /* mute internal speaker */ |
| 9609 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9610 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9611 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9612 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9613 | } else { |
| 9614 | /* unmute internal speaker if necessary */ |
| 9615 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9616 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9617 | HDA_AMP_MUTE, mute); |
| 9618 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9619 | HDA_AMP_MUTE, mute); |
| 9620 | } |
| 9621 | } |
| 9622 | |
| 9623 | /* unsolicited event for HP jack sensing */ |
| 9624 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 9625 | unsigned int res) |
| 9626 | { |
| 9627 | if ((res >> 26) != ALC_HP_EVENT) |
| 9628 | return; |
| 9629 | alc262_lenovo_3000_automute(codec, 1); |
| 9630 | } |
| 9631 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9632 | /* bind hp and internal speaker mute (with plug check) */ |
| 9633 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9634 | struct snd_ctl_elem_value *ucontrol) |
| 9635 | { |
| 9636 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9637 | long *valp = ucontrol->value.integer.value; |
| 9638 | int change; |
| 9639 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9640 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9641 | HDA_AMP_MUTE, |
| 9642 | valp ? 0 : HDA_AMP_MUTE); |
| 9643 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9644 | HDA_AMP_MUTE, |
| 9645 | valp ? 0 : HDA_AMP_MUTE); |
| 9646 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 9647 | if (change) |
| 9648 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9649 | return change; |
| 9650 | } |
| 9651 | |
| 9652 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9653 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9654 | { |
| 9655 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9656 | .name = "Master Playback Switch", |
| 9657 | .info = snd_hda_mixer_amp_switch_info, |
| 9658 | .get = snd_hda_mixer_amp_switch_get, |
| 9659 | .put = alc262_fujitsu_master_sw_put, |
| 9660 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9661 | }, |
| 9662 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9663 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 9664 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 9665 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9666 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9668 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9669 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9670 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9671 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9672 | { } /* end */ |
| 9673 | }; |
| 9674 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9675 | /* bind hp and internal speaker mute (with plug check) */ |
| 9676 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9677 | struct snd_ctl_elem_value *ucontrol) |
| 9678 | { |
| 9679 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9680 | long *valp = ucontrol->value.integer.value; |
| 9681 | int change; |
| 9682 | |
| 9683 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9684 | HDA_AMP_MUTE, |
| 9685 | valp ? 0 : HDA_AMP_MUTE); |
| 9686 | |
| 9687 | if (change) |
| 9688 | alc262_lenovo_3000_automute(codec, 0); |
| 9689 | return change; |
| 9690 | } |
| 9691 | |
| 9692 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 9693 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9694 | { |
| 9695 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9696 | .name = "Master Playback Switch", |
| 9697 | .info = snd_hda_mixer_amp_switch_info, |
| 9698 | .get = snd_hda_mixer_amp_switch_get, |
| 9699 | .put = alc262_lenovo_3000_master_sw_put, |
| 9700 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 9701 | }, |
| 9702 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9703 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9704 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9705 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9706 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9707 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9708 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9709 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9710 | { } /* end */ |
| 9711 | }; |
| 9712 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 9713 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 9714 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9715 | { |
| 9716 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9717 | .name = "Master Playback Switch", |
| 9718 | .info = snd_hda_mixer_amp_switch_info, |
| 9719 | .get = snd_hda_mixer_amp_switch_get, |
| 9720 | .put = alc262_sony_master_sw_put, |
| 9721 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9722 | }, |
| 9723 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9724 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9725 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9726 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9727 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9728 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9729 | { } /* end */ |
| 9730 | }; |
| 9731 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9732 | /* additional init verbs for Benq laptops */ |
| 9733 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 9734 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9735 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9736 | {} |
| 9737 | }; |
| 9738 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9739 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 9740 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9741 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9742 | |
| 9743 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9744 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 9745 | {} |
| 9746 | }; |
| 9747 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9748 | /* Samsung Q1 Ultra Vista model setup */ |
| 9749 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9750 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9751 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9752 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9753 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9754 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9755 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9756 | { } /* end */ |
| 9757 | }; |
| 9758 | |
| 9759 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9760 | /* output mixer */ |
| 9761 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9762 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9763 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9764 | /* speaker */ |
| 9765 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9766 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9767 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9768 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9769 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9770 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9771 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9772 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9773 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9774 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9775 | /* internal mic */ |
| 9776 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9777 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9778 | /* ADC, choose mic */ |
| 9779 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9780 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9781 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9782 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9783 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9784 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9785 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9786 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9787 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 9788 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9789 | {} |
| 9790 | }; |
| 9791 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9792 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9793 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9794 | { |
| 9795 | struct alc_spec *spec = codec->spec; |
| 9796 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9797 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9798 | mute = 0; |
| 9799 | /* auto-mute only when HP is used as HP */ |
| 9800 | if (!spec->cur_mux[0]) { |
| 9801 | unsigned int present; |
| 9802 | /* need to execute and sync at first */ |
| 9803 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9804 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9805 | AC_VERB_GET_PIN_SENSE, 0); |
| 9806 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9807 | if (spec->jack_present) |
| 9808 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9809 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9810 | /* mute/unmute internal speaker */ |
| 9811 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9812 | HDA_AMP_MUTE, mute); |
| 9813 | /* mute/unmute HP */ |
| 9814 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9815 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9816 | } |
| 9817 | |
| 9818 | /* unsolicited event for HP jack sensing */ |
| 9819 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9820 | unsigned int res) |
| 9821 | { |
| 9822 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9823 | return; |
| 9824 | alc262_ultra_automute(codec); |
| 9825 | } |
| 9826 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9827 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9828 | .num_items = 2, |
| 9829 | .items = { |
| 9830 | { "Mic", 0x1 }, |
| 9831 | { "Headphone", 0x7 }, |
| 9832 | }, |
| 9833 | }; |
| 9834 | |
| 9835 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9836 | struct snd_ctl_elem_value *ucontrol) |
| 9837 | { |
| 9838 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9839 | struct alc_spec *spec = codec->spec; |
| 9840 | int ret; |
| 9841 | |
| 9842 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 9843 | if (!ret) |
| 9844 | return 0; |
| 9845 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9846 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9847 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9848 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9849 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9850 | return ret; |
| 9851 | } |
| 9852 | |
| 9853 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9854 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9855 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9856 | { |
| 9857 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9858 | .name = "Capture Source", |
| 9859 | .info = alc882_mux_enum_info, |
| 9860 | .get = alc882_mux_enum_get, |
| 9861 | .put = alc262_ultra_mux_enum_put, |
| 9862 | }, |
| 9863 | { } /* end */ |
| 9864 | }; |
| 9865 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9866 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9867 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9868 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9869 | { |
| 9870 | hda_nid_t nid; |
| 9871 | int err; |
| 9872 | |
| 9873 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9874 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9875 | spec->multiout.dac_nids[0] = 2; |
| 9876 | |
| 9877 | nid = cfg->line_out_pins[0]; |
| 9878 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9879 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9880 | "Front Playback Volume", |
| 9881 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9882 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9883 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9884 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9885 | "Front Playback Switch", |
| 9886 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9887 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9888 | return err; |
| 9889 | } |
| 9890 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9891 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9892 | if (nid) { |
| 9893 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9894 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9895 | "Speaker Playback Volume", |
| 9896 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9897 | HDA_OUTPUT)); |
| 9898 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9899 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9900 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9901 | "Speaker Playback Switch", |
| 9902 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9903 | HDA_OUTPUT)); |
| 9904 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9905 | return err; |
| 9906 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9907 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9908 | "Speaker Playback Switch", |
| 9909 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9910 | HDA_OUTPUT)); |
| 9911 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9912 | return err; |
| 9913 | } |
| 9914 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9915 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9916 | if (nid) { |
| 9917 | /* spec->multiout.hp_nid = 2; */ |
| 9918 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9919 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9920 | "Headphone Playback Volume", |
| 9921 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9922 | HDA_OUTPUT)); |
| 9923 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9924 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9925 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9926 | "Headphone Playback Switch", |
| 9927 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9928 | HDA_OUTPUT)); |
| 9929 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9930 | return err; |
| 9931 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9932 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9933 | "Headphone Playback Switch", |
| 9934 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9935 | HDA_OUTPUT)); |
| 9936 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9937 | return err; |
| 9938 | } |
| 9939 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9940 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9941 | } |
| 9942 | |
| 9943 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9944 | #define alc262_auto_create_analog_input_ctls \ |
| 9945 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9946 | |
| 9947 | /* |
| 9948 | * generic initialization of ADC, input mixers and output mixers |
| 9949 | */ |
| 9950 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9951 | /* |
| 9952 | * Unmute ADC0-2 and set the default input to mic-in |
| 9953 | */ |
| 9954 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9955 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9956 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9957 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9958 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9959 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9960 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9961 | /* 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] | 9962 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9963 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9964 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9965 | */ |
| 9966 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9967 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9968 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9969 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9970 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9971 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9972 | |
| 9973 | /* |
| 9974 | * Set up output mixers (0x0c - 0x0f) |
| 9975 | */ |
| 9976 | /* set vol=0 to output mixers */ |
| 9977 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9978 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9979 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9980 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9981 | /* set up input amps for analog loopback */ |
| 9982 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9983 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9984 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9985 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9986 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9987 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9988 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9989 | |
| 9990 | /* FIXME: use matrix-type input source selection */ |
| 9991 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9992 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9993 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9994 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9995 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9996 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9997 | /* Input mixer2 */ |
| 9998 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9999 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10000 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10001 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10002 | /* Input mixer3 */ |
| 10003 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10004 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10005 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10006 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10007 | |
| 10008 | { } |
| 10009 | }; |
| 10010 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10011 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10012 | /* |
| 10013 | * Unmute ADC0-2 and set the default input to mic-in |
| 10014 | */ |
| 10015 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10016 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10017 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10018 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10019 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10020 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10021 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10022 | /* 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] | 10023 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10024 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10025 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10026 | */ |
| 10027 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10028 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10029 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10030 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10031 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10032 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10033 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10034 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10035 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10036 | /* |
| 10037 | * Set up output mixers (0x0c - 0x0e) |
| 10038 | */ |
| 10039 | /* set vol=0 to output mixers */ |
| 10040 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10041 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10042 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10043 | |
| 10044 | /* set up input amps for analog loopback */ |
| 10045 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10047 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10049 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10050 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10051 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10052 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10053 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10054 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10055 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10056 | |
| 10057 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10058 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10059 | |
| 10060 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10061 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10062 | |
| 10063 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10064 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10065 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10066 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10067 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10068 | |
| 10069 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10070 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10071 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10072 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10073 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10074 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10075 | |
| 10076 | |
| 10077 | /* FIXME: use matrix-type input source selection */ |
| 10078 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10079 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10080 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10081 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10082 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10083 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10084 | /* Input mixer2 */ |
| 10085 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10086 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10087 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10088 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10089 | /* Input mixer3 */ |
| 10090 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10091 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10092 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10093 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10094 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10095 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10096 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10097 | { } |
| 10098 | }; |
| 10099 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10100 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10101 | /* |
| 10102 | * Unmute ADC0-2 and set the default input to mic-in |
| 10103 | */ |
| 10104 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10105 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10106 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10107 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10108 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10109 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10110 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10111 | /* 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] | 10112 | * mixer widget |
| 10113 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10114 | * panel mic (mic 2) |
| 10115 | */ |
| 10116 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10118 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10119 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10120 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10121 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10122 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10123 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10124 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10125 | /* |
| 10126 | * Set up output mixers (0x0c - 0x0e) |
| 10127 | */ |
| 10128 | /* set vol=0 to output mixers */ |
| 10129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10130 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10131 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10132 | |
| 10133 | /* set up input amps for analog loopback */ |
| 10134 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10135 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10136 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10137 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10138 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10139 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10140 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10141 | |
| 10142 | |
| 10143 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10144 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10145 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10146 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10147 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10148 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10149 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10150 | |
| 10151 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10152 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10153 | |
| 10154 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10155 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10156 | |
| 10157 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10158 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10159 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10160 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10161 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10162 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10163 | |
| 10164 | /* FIXME: use matrix-type input source selection */ |
| 10165 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10166 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10167 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10168 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10169 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10170 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10171 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10172 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10173 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10174 | /* Input mixer2 */ |
| 10175 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10176 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10177 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10178 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10179 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10180 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10181 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10182 | /* Input mixer3 */ |
| 10183 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10186 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10187 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10188 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10189 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10190 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10191 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10192 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10193 | { } |
| 10194 | }; |
| 10195 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10196 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10197 | |
| 10198 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10199 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10200 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10201 | |
| 10202 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10203 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10204 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10205 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10206 | |
| 10207 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10208 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10209 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10210 | {} |
| 10211 | }; |
| 10212 | |
| 10213 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10214 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10215 | #define alc262_loopbacks alc880_loopbacks |
| 10216 | #endif |
| 10217 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10218 | /* pcm configuration: identiacal with ALC880 */ |
| 10219 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10220 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10221 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10222 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10223 | |
| 10224 | /* |
| 10225 | * BIOS auto configuration |
| 10226 | */ |
| 10227 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10228 | { |
| 10229 | struct alc_spec *spec = codec->spec; |
| 10230 | int err; |
| 10231 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10232 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10233 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10234 | alc262_ignore); |
| 10235 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10236 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10237 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10238 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10239 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10240 | if (err < 0) |
| 10241 | return err; |
| 10242 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10243 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10244 | return err; |
| 10245 | |
| 10246 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10247 | |
| 10248 | if (spec->autocfg.dig_out_pin) |
| 10249 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 10250 | if (spec->autocfg.dig_in_pin) |
| 10251 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10252 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 10253 | if (spec->kctls.list) |
| 10254 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10255 | |
| 10256 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10257 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10258 | spec->input_mux = &spec->private_imux; |
| 10259 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10260 | err = alc_auto_add_mic_boost(codec); |
| 10261 | if (err < 0) |
| 10262 | return err; |
| 10263 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10264 | return 1; |
| 10265 | } |
| 10266 | |
| 10267 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10268 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10269 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10270 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10271 | |
| 10272 | |
| 10273 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10274 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10275 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10276 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10277 | alc262_auto_init_multi_out(codec); |
| 10278 | alc262_auto_init_hp_out(codec); |
| 10279 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10280 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10281 | if (spec->unsol_event) |
| 10282 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10283 | } |
| 10284 | |
| 10285 | /* |
| 10286 | * configuration and preset |
| 10287 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10288 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10289 | [ALC262_BASIC] = "basic", |
| 10290 | [ALC262_HIPPO] = "hippo", |
| 10291 | [ALC262_HIPPO_1] = "hippo_1", |
| 10292 | [ALC262_FUJITSU] = "fujitsu", |
| 10293 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10294 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10295 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10296 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10297 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10298 | [ALC262_BENQ_T31] = "benq-t31", |
| 10299 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10300 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10301 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10302 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10303 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10304 | [ALC262_NEC] = "nec", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10305 | [ALC262_AUTO] = "auto", |
| 10306 | }; |
| 10307 | |
| 10308 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10309 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10310 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10311 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10312 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10313 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 10314 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10315 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10316 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10317 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10318 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10319 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10320 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10321 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10322 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10323 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10324 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10325 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10326 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10327 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10328 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10329 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10330 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10331 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10332 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10333 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10334 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10335 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10336 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10337 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10338 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10339 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10340 | SND_PCI_QUIRK(0x1179, 0x0268, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10341 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10342 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10343 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10344 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10345 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10346 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10347 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10348 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10349 | {} |
| 10350 | }; |
| 10351 | |
| 10352 | static struct alc_config_preset alc262_presets[] = { |
| 10353 | [ALC262_BASIC] = { |
| 10354 | .mixers = { alc262_base_mixer }, |
| 10355 | .init_verbs = { alc262_init_verbs }, |
| 10356 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10357 | .dac_nids = alc262_dac_nids, |
| 10358 | .hp_nid = 0x03, |
| 10359 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10360 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10361 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10362 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10363 | [ALC262_HIPPO] = { |
| 10364 | .mixers = { alc262_base_mixer }, |
| 10365 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10366 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10367 | .dac_nids = alc262_dac_nids, |
| 10368 | .hp_nid = 0x03, |
| 10369 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10370 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10371 | .channel_mode = alc262_modes, |
| 10372 | .input_mux = &alc262_capture_source, |
| 10373 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10374 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10375 | }, |
| 10376 | [ALC262_HIPPO_1] = { |
| 10377 | .mixers = { alc262_hippo1_mixer }, |
| 10378 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10379 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10380 | .dac_nids = alc262_dac_nids, |
| 10381 | .hp_nid = 0x02, |
| 10382 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10383 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10384 | .channel_mode = alc262_modes, |
| 10385 | .input_mux = &alc262_capture_source, |
| 10386 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10387 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10388 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10389 | [ALC262_FUJITSU] = { |
| 10390 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10391 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10392 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10393 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10394 | .dac_nids = alc262_dac_nids, |
| 10395 | .hp_nid = 0x03, |
| 10396 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10397 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10398 | .channel_mode = alc262_modes, |
| 10399 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10400 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10401 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10402 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10403 | [ALC262_HP_BPC] = { |
| 10404 | .mixers = { alc262_HP_BPC_mixer }, |
| 10405 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10406 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10407 | .dac_nids = alc262_dac_nids, |
| 10408 | .hp_nid = 0x03, |
| 10409 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10410 | .channel_mode = alc262_modes, |
| 10411 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10412 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10413 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10414 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10415 | [ALC262_HP_BPC_D7000_WF] = { |
| 10416 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10417 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10418 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10419 | .dac_nids = alc262_dac_nids, |
| 10420 | .hp_nid = 0x03, |
| 10421 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10422 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10423 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10424 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10425 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10426 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10427 | [ALC262_HP_BPC_D7000_WL] = { |
| 10428 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10429 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10430 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10431 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10432 | .dac_nids = alc262_dac_nids, |
| 10433 | .hp_nid = 0x03, |
| 10434 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10435 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10436 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10437 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10438 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10439 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10440 | [ALC262_HP_TC_T5735] = { |
| 10441 | .mixers = { alc262_hp_t5735_mixer }, |
| 10442 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10443 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10444 | .dac_nids = alc262_dac_nids, |
| 10445 | .hp_nid = 0x03, |
| 10446 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10447 | .channel_mode = alc262_modes, |
| 10448 | .input_mux = &alc262_capture_source, |
| 10449 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10450 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10451 | }, |
| 10452 | [ALC262_HP_RP5700] = { |
| 10453 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10454 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10455 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10456 | .dac_nids = alc262_dac_nids, |
| 10457 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10458 | .channel_mode = alc262_modes, |
| 10459 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10460 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10461 | [ALC262_BENQ_ED8] = { |
| 10462 | .mixers = { alc262_base_mixer }, |
| 10463 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10464 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10465 | .dac_nids = alc262_dac_nids, |
| 10466 | .hp_nid = 0x03, |
| 10467 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10468 | .channel_mode = alc262_modes, |
| 10469 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10470 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10471 | [ALC262_SONY_ASSAMD] = { |
| 10472 | .mixers = { alc262_sony_mixer }, |
| 10473 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10474 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10475 | .dac_nids = alc262_dac_nids, |
| 10476 | .hp_nid = 0x02, |
| 10477 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10478 | .channel_mode = alc262_modes, |
| 10479 | .input_mux = &alc262_capture_source, |
| 10480 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10481 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10482 | }, |
| 10483 | [ALC262_BENQ_T31] = { |
| 10484 | .mixers = { alc262_benq_t31_mixer }, |
| 10485 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10486 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10487 | .dac_nids = alc262_dac_nids, |
| 10488 | .hp_nid = 0x03, |
| 10489 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10490 | .channel_mode = alc262_modes, |
| 10491 | .input_mux = &alc262_capture_source, |
| 10492 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10493 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10494 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10495 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10496 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 10497 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10498 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10499 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10500 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10501 | .channel_mode = alc262_modes, |
| 10502 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10503 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10504 | .capsrc_nids = alc262_capsrc_nids, |
| 10505 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10506 | .unsol_event = alc262_ultra_unsol_event, |
| 10507 | .init_hook = alc262_ultra_automute, |
| 10508 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10509 | [ALC262_LENOVO_3000] = { |
| 10510 | .mixers = { alc262_lenovo_3000_mixer }, |
| 10511 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10512 | alc262_lenovo_3000_unsol_verbs }, |
| 10513 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10514 | .dac_nids = alc262_dac_nids, |
| 10515 | .hp_nid = 0x03, |
| 10516 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10517 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10518 | .channel_mode = alc262_modes, |
| 10519 | .input_mux = &alc262_fujitsu_capture_source, |
| 10520 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 10521 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10522 | [ALC262_NEC] = { |
| 10523 | .mixers = { alc262_nec_mixer }, |
| 10524 | .init_verbs = { alc262_nec_verbs }, |
| 10525 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10526 | .dac_nids = alc262_dac_nids, |
| 10527 | .hp_nid = 0x03, |
| 10528 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10529 | .channel_mode = alc262_modes, |
| 10530 | .input_mux = &alc262_capture_source, |
| 10531 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10532 | [ALC262_TOSHIBA_S06] = { |
| 10533 | .mixers = { alc262_toshiba_s06_mixer }, |
| 10534 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 10535 | alc262_eapd_verbs }, |
| 10536 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10537 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 10538 | .dac_nids = alc262_dac_nids, |
| 10539 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 10540 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10541 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10542 | .channel_mode = alc262_modes, |
| 10543 | .input_mux = &alc262_dmic_capture_source, |
| 10544 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 10545 | .init_hook = alc262_toshiba_s06_init_hook, |
| 10546 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10547 | [ALC262_TOSHIBA_RX1] = { |
| 10548 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 10549 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 10550 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10551 | .dac_nids = alc262_dac_nids, |
| 10552 | .hp_nid = 0x03, |
| 10553 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10554 | .channel_mode = alc262_modes, |
| 10555 | .input_mux = &alc262_capture_source, |
| 10556 | .unsol_event = alc262_hippo_unsol_event, |
| 10557 | .init_hook = alc262_hippo_automute, |
| 10558 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10559 | }; |
| 10560 | |
| 10561 | static int patch_alc262(struct hda_codec *codec) |
| 10562 | { |
| 10563 | struct alc_spec *spec; |
| 10564 | int board_config; |
| 10565 | int err; |
| 10566 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 10567 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10568 | if (spec == NULL) |
| 10569 | return -ENOMEM; |
| 10570 | |
| 10571 | codec->spec = spec; |
| 10572 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10573 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 10574 | * under-run |
| 10575 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10576 | { |
| 10577 | int tmp; |
| 10578 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10579 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 10580 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10581 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 10582 | } |
| 10583 | #endif |
| 10584 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 10585 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10586 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10587 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 10588 | alc262_models, |
| 10589 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10590 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10591 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10592 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 10593 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10594 | board_config = ALC262_AUTO; |
| 10595 | } |
| 10596 | |
| 10597 | if (board_config == ALC262_AUTO) { |
| 10598 | /* automatic parse from the BIOS config */ |
| 10599 | err = alc262_parse_auto_config(codec); |
| 10600 | if (err < 0) { |
| 10601 | alc_free(codec); |
| 10602 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10603 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10604 | printk(KERN_INFO |
| 10605 | "hda_codec: Cannot set up configuration " |
| 10606 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10607 | board_config = ALC262_BASIC; |
| 10608 | } |
| 10609 | } |
| 10610 | |
| 10611 | if (board_config != ALC262_AUTO) |
| 10612 | setup_preset(spec, &alc262_presets[board_config]); |
| 10613 | |
| 10614 | spec->stream_name_analog = "ALC262 Analog"; |
| 10615 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 10616 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10617 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10618 | spec->stream_name_digital = "ALC262 Digital"; |
| 10619 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 10620 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 10621 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10622 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10623 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 10624 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 10625 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10626 | /* get type */ |
| 10627 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10628 | if (wcap != AC_WID_AUD_IN) { |
| 10629 | spec->adc_nids = alc262_adc_nids_alt; |
| 10630 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10631 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10632 | spec->mixers[spec->num_mixers] = |
| 10633 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10634 | spec->num_mixers++; |
| 10635 | } else { |
| 10636 | spec->adc_nids = alc262_adc_nids; |
| 10637 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10638 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10639 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 10640 | spec->num_mixers++; |
| 10641 | } |
| 10642 | } |
| 10643 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10644 | spec->vmaster_nid = 0x0c; |
| 10645 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10646 | codec->patch_ops = alc_patch_ops; |
| 10647 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10648 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10649 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10650 | if (!spec->loopback.amplist) |
| 10651 | spec->loopback.amplist = alc262_loopbacks; |
| 10652 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10653 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10654 | return 0; |
| 10655 | } |
| 10656 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10657 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10658 | * ALC268 channel source setting (2 channel) |
| 10659 | */ |
| 10660 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 10661 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10662 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10663 | static hda_nid_t alc268_dac_nids[2] = { |
| 10664 | /* front, hp */ |
| 10665 | 0x02, 0x03 |
| 10666 | }; |
| 10667 | |
| 10668 | static hda_nid_t alc268_adc_nids[2] = { |
| 10669 | /* ADC0-1 */ |
| 10670 | 0x08, 0x07 |
| 10671 | }; |
| 10672 | |
| 10673 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 10674 | /* ADC0 */ |
| 10675 | 0x08 |
| 10676 | }; |
| 10677 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10678 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 10679 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10680 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 10681 | /* output mixer control */ |
| 10682 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10683 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10684 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10685 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10686 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10687 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10688 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10689 | { } |
| 10690 | }; |
| 10691 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10692 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 10693 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 10694 | .ops = &snd_hda_bind_sw, |
| 10695 | .values = { |
| 10696 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 10697 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 10698 | 0 |
| 10699 | }, |
| 10700 | }; |
| 10701 | |
| 10702 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 10703 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 10704 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 10705 | { } |
| 10706 | }; |
| 10707 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10708 | static struct hda_verb alc268_eapd_verbs[] = { |
| 10709 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10710 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10711 | { } |
| 10712 | }; |
| 10713 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10714 | /* Toshiba specific */ |
| 10715 | #define alc268_toshiba_automute alc262_hippo_automute |
| 10716 | |
| 10717 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 10718 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10719 | { } /* end */ |
| 10720 | }; |
| 10721 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10722 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 10723 | .num_items = 2, |
| 10724 | .items = { |
| 10725 | { "i-Mic", 0x6 }, |
| 10726 | { "E-Mic", 0x0 }, |
| 10727 | }, |
| 10728 | }; |
| 10729 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10730 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10731 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 10732 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 10733 | .ops = &snd_hda_bind_vol, |
| 10734 | .values = { |
| 10735 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 10736 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 10737 | 0 |
| 10738 | }, |
| 10739 | }; |
| 10740 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10741 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10742 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 10743 | { |
| 10744 | struct alc_spec *spec = codec->spec; |
| 10745 | unsigned int mute; |
| 10746 | |
| 10747 | if (force || !spec->sense_updated) { |
| 10748 | unsigned int present; |
| 10749 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10750 | AC_VERB_GET_PIN_SENSE, 0); |
| 10751 | spec->jack_present = (present & 0x80000000) != 0; |
| 10752 | spec->sense_updated = 1; |
| 10753 | } |
| 10754 | if (spec->jack_present) |
| 10755 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 10756 | else /* unmute internal speaker if necessary */ |
| 10757 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 10758 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10759 | HDA_AMP_MUTE, mute); |
| 10760 | } |
| 10761 | |
| 10762 | |
| 10763 | /* bind hp and internal speaker mute (with plug check) */ |
| 10764 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10765 | struct snd_ctl_elem_value *ucontrol) |
| 10766 | { |
| 10767 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10768 | long *valp = ucontrol->value.integer.value; |
| 10769 | int change; |
| 10770 | |
| 10771 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10772 | HDA_AMP_MUTE, |
| 10773 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 10774 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10775 | HDA_AMP_MUTE, |
| 10776 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 10777 | if (change) |
| 10778 | alc268_acer_automute(codec, 0); |
| 10779 | return change; |
| 10780 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10781 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10782 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 10783 | /* output mixer control */ |
| 10784 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10785 | { |
| 10786 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10787 | .name = "Master Playback Switch", |
| 10788 | .info = snd_hda_mixer_amp_switch_info, |
| 10789 | .get = snd_hda_mixer_amp_switch_get, |
| 10790 | .put = alc268_acer_master_sw_put, |
| 10791 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10792 | }, |
| 10793 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 10794 | { } |
| 10795 | }; |
| 10796 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10797 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 10798 | /* output mixer control */ |
| 10799 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10800 | { |
| 10801 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10802 | .name = "Master Playback Switch", |
| 10803 | .info = snd_hda_mixer_amp_switch_info, |
| 10804 | .get = snd_hda_mixer_amp_switch_get, |
| 10805 | .put = alc268_acer_master_sw_put, |
| 10806 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10807 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10808 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10809 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10810 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10811 | { } |
| 10812 | }; |
| 10813 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10814 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 10815 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10816 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10817 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10818 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10819 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 10820 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 10821 | { } |
| 10822 | }; |
| 10823 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10824 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10825 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 10826 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10827 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10828 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10829 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10830 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10831 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10832 | { } |
| 10833 | }; |
| 10834 | |
| 10835 | /* unsolicited event for HP jack sensing */ |
| 10836 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 10837 | unsigned int res) |
| 10838 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10839 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10840 | return; |
| 10841 | alc268_toshiba_automute(codec); |
| 10842 | } |
| 10843 | |
| 10844 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 10845 | unsigned int res) |
| 10846 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10847 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10848 | return; |
| 10849 | alc268_acer_automute(codec, 1); |
| 10850 | } |
| 10851 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10852 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 10853 | { |
| 10854 | alc268_acer_automute(codec, 1); |
| 10855 | } |
| 10856 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10857 | /* toggle speaker-output according to the hp-jack state */ |
| 10858 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 10859 | { |
| 10860 | unsigned int present; |
| 10861 | unsigned char bits; |
| 10862 | |
| 10863 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10864 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10865 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 10866 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 10867 | AMP_IN_MUTE(0), bits); |
| 10868 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 10869 | AMP_IN_MUTE(0), bits); |
| 10870 | } |
| 10871 | |
| 10872 | |
| 10873 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 10874 | { |
| 10875 | unsigned int present; |
| 10876 | |
| 10877 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10878 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10879 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 10880 | present ? 0x0 : 0x6); |
| 10881 | } |
| 10882 | |
| 10883 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 10884 | unsigned int res) |
| 10885 | { |
| 10886 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10887 | alc268_aspire_one_speaker_automute(codec); |
| 10888 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10889 | alc268_acer_mic_automute(codec); |
| 10890 | } |
| 10891 | |
| 10892 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 10893 | { |
| 10894 | alc268_aspire_one_speaker_automute(codec); |
| 10895 | alc268_acer_mic_automute(codec); |
| 10896 | } |
| 10897 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10898 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 10899 | /* output mixer control */ |
| 10900 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10901 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10902 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10903 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10904 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10905 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10906 | { } |
| 10907 | }; |
| 10908 | |
| 10909 | static struct hda_verb alc268_dell_verbs[] = { |
| 10910 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10911 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10912 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10913 | { } |
| 10914 | }; |
| 10915 | |
| 10916 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10917 | static void alc268_dell_automute(struct hda_codec *codec) |
| 10918 | { |
| 10919 | unsigned int present; |
| 10920 | unsigned int mute; |
| 10921 | |
| 10922 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 10923 | if (present & 0x80000000) |
| 10924 | mute = HDA_AMP_MUTE; |
| 10925 | else |
| 10926 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 10927 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10928 | HDA_AMP_MUTE, mute); |
| 10929 | } |
| 10930 | |
| 10931 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 10932 | unsigned int res) |
| 10933 | { |
| 10934 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10935 | return; |
| 10936 | alc268_dell_automute(codec); |
| 10937 | } |
| 10938 | |
| 10939 | #define alc268_dell_init_hook alc268_dell_automute |
| 10940 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10941 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 10942 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10943 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10944 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10945 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10946 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10947 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10948 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 10949 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10950 | { } |
| 10951 | }; |
| 10952 | |
| 10953 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 10954 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10955 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 10956 | { } |
| 10957 | }; |
| 10958 | |
| 10959 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 10960 | { |
| 10961 | unsigned int present; |
| 10962 | |
| 10963 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 10964 | & AC_PINSENSE_PRESENCE; |
| 10965 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10966 | present ? 0 : PIN_OUT); |
| 10967 | } |
| 10968 | |
| 10969 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 10970 | { |
| 10971 | unsigned int present; |
| 10972 | |
| 10973 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10974 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10975 | snd_hda_codec_write(codec, 0x23, 0, |
| 10976 | AC_VERB_SET_CONNECT_SEL, |
| 10977 | present ? 0x00 : 0x01); |
| 10978 | } |
| 10979 | |
| 10980 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 10981 | { |
| 10982 | alc267_quanta_il1_hp_automute(codec); |
| 10983 | alc267_quanta_il1_mic_automute(codec); |
| 10984 | } |
| 10985 | |
| 10986 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 10987 | unsigned int res) |
| 10988 | { |
| 10989 | switch (res >> 26) { |
| 10990 | case ALC880_HP_EVENT: |
| 10991 | alc267_quanta_il1_hp_automute(codec); |
| 10992 | break; |
| 10993 | case ALC880_MIC_EVENT: |
| 10994 | alc267_quanta_il1_mic_automute(codec); |
| 10995 | break; |
| 10996 | } |
| 10997 | } |
| 10998 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10999 | /* |
| 11000 | * generic initialization of ADC, input mixers and output mixers |
| 11001 | */ |
| 11002 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11003 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11004 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11005 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11006 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11007 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11008 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11009 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11010 | |
| 11011 | /* |
| 11012 | * Set up output mixers (0x0c - 0x0e) |
| 11013 | */ |
| 11014 | /* set vol=0 to output mixers */ |
| 11015 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11016 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11017 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11018 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11019 | |
| 11020 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11021 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11022 | |
| 11023 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11024 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11025 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11026 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11027 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11028 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11029 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11030 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11031 | |
| 11032 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11033 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11034 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11035 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11036 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11037 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11038 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11039 | |
| 11040 | /* set PCBEEP vol = 0, mute connections */ |
| 11041 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11042 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11043 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11044 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11045 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11046 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11047 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11048 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11049 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11050 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11051 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11052 | { } |
| 11053 | }; |
| 11054 | |
| 11055 | /* |
| 11056 | * generic initialization of ADC, input mixers and output mixers |
| 11057 | */ |
| 11058 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11059 | /* set output DAC */ |
| 11060 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11061 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11062 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11063 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11064 | |
| 11065 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11066 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11067 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11068 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11069 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11070 | |
| 11071 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11072 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11073 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11074 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11075 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11076 | |
| 11077 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11078 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11079 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11080 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11081 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11082 | /* set PCBEEP vol = 0, mute connections */ |
| 11083 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11084 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11085 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11086 | |
| 11087 | { } |
| 11088 | }; |
| 11089 | |
| 11090 | #define alc268_mux_enum_info alc_mux_enum_info |
| 11091 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11092 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11093 | |
| 11094 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11095 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11096 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11097 | { |
| 11098 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11099 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11100 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11101 | */ |
| 11102 | /* .name = "Capture Source", */ |
| 11103 | .name = "Input Source", |
| 11104 | .count = 1, |
| 11105 | .info = alc268_mux_enum_info, |
| 11106 | .get = alc268_mux_enum_get, |
| 11107 | .put = alc268_mux_enum_put, |
| 11108 | }, |
| 11109 | { } /* end */ |
| 11110 | }; |
| 11111 | |
| 11112 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11113 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11114 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11115 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11116 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11117 | { |
| 11118 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11119 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11120 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11121 | */ |
| 11122 | /* .name = "Capture Source", */ |
| 11123 | .name = "Input Source", |
| 11124 | .count = 2, |
| 11125 | .info = alc268_mux_enum_info, |
| 11126 | .get = alc268_mux_enum_get, |
| 11127 | .put = alc268_mux_enum_put, |
| 11128 | }, |
| 11129 | { } /* end */ |
| 11130 | }; |
| 11131 | |
| 11132 | static struct hda_input_mux alc268_capture_source = { |
| 11133 | .num_items = 4, |
| 11134 | .items = { |
| 11135 | { "Mic", 0x0 }, |
| 11136 | { "Front Mic", 0x1 }, |
| 11137 | { "Line", 0x2 }, |
| 11138 | { "CD", 0x3 }, |
| 11139 | }, |
| 11140 | }; |
| 11141 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11142 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11143 | .num_items = 3, |
| 11144 | .items = { |
| 11145 | { "Mic", 0x0 }, |
| 11146 | { "Internal Mic", 0x6 }, |
| 11147 | { "Line", 0x2 }, |
| 11148 | }, |
| 11149 | }; |
| 11150 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11151 | #ifdef CONFIG_SND_DEBUG |
| 11152 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11153 | /* Volume widgets */ |
| 11154 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11155 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11156 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11157 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11158 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11159 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11160 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11161 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11162 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11163 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11164 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11165 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11166 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11167 | /* The below appears problematic on some hardwares */ |
| 11168 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11169 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11170 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11171 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11172 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11173 | |
| 11174 | /* Modes for retasking pin widgets */ |
| 11175 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11176 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11177 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11178 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11179 | |
| 11180 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11181 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11182 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11183 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11184 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11185 | |
| 11186 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11187 | * The ALC268 does not have an SPDIF input. |
| 11188 | */ |
| 11189 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11190 | |
| 11191 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11192 | * this output to turn on an external amplifier. |
| 11193 | */ |
| 11194 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11195 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11196 | |
| 11197 | { } /* end */ |
| 11198 | }; |
| 11199 | #endif |
| 11200 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11201 | /* create input playback/capture controls for the given pin */ |
| 11202 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11203 | const char *ctlname, int idx) |
| 11204 | { |
| 11205 | char name[32]; |
| 11206 | int err; |
| 11207 | |
| 11208 | sprintf(name, "%s Playback Volume", ctlname); |
| 11209 | if (nid == 0x14) { |
| 11210 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11211 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11212 | HDA_OUTPUT)); |
| 11213 | if (err < 0) |
| 11214 | return err; |
| 11215 | } else if (nid == 0x15) { |
| 11216 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11217 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11218 | HDA_OUTPUT)); |
| 11219 | if (err < 0) |
| 11220 | return err; |
| 11221 | } else |
| 11222 | return -1; |
| 11223 | sprintf(name, "%s Playback Switch", ctlname); |
| 11224 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11225 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11226 | if (err < 0) |
| 11227 | return err; |
| 11228 | return 0; |
| 11229 | } |
| 11230 | |
| 11231 | /* add playback controls from the parsed DAC table */ |
| 11232 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11233 | const struct auto_pin_cfg *cfg) |
| 11234 | { |
| 11235 | hda_nid_t nid; |
| 11236 | int err; |
| 11237 | |
| 11238 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11239 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11240 | spec->multiout.dac_nids[0] = 2; |
| 11241 | spec->multiout.dac_nids[1] = 3; |
| 11242 | |
| 11243 | nid = cfg->line_out_pins[0]; |
| 11244 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11245 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11246 | |
| 11247 | nid = cfg->speaker_pins[0]; |
| 11248 | if (nid == 0x1d) { |
| 11249 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11250 | "Speaker Playback Volume", |
| 11251 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11252 | if (err < 0) |
| 11253 | return err; |
| 11254 | } |
| 11255 | nid = cfg->hp_pins[0]; |
| 11256 | if (nid) |
| 11257 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11258 | |
| 11259 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11260 | if (nid == 0x16) { |
| 11261 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11262 | "Mono Playback Switch", |
| 11263 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11264 | if (err < 0) |
| 11265 | return err; |
| 11266 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11267 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11268 | } |
| 11269 | |
| 11270 | /* create playback/capture controls for input pins */ |
| 11271 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11272 | const struct auto_pin_cfg *cfg) |
| 11273 | { |
| 11274 | struct hda_input_mux *imux = &spec->private_imux; |
| 11275 | int i, idx1; |
| 11276 | |
| 11277 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11278 | switch(cfg->input_pins[i]) { |
| 11279 | case 0x18: |
| 11280 | idx1 = 0; /* Mic 1 */ |
| 11281 | break; |
| 11282 | case 0x19: |
| 11283 | idx1 = 1; /* Mic 2 */ |
| 11284 | break; |
| 11285 | case 0x1a: |
| 11286 | idx1 = 2; /* Line In */ |
| 11287 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11288 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11289 | idx1 = 3; /* CD */ |
| 11290 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11291 | case 0x12: |
| 11292 | case 0x13: |
| 11293 | idx1 = 6; /* digital mics */ |
| 11294 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11295 | default: |
| 11296 | continue; |
| 11297 | } |
| 11298 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11299 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11300 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11301 | } |
| 11302 | return 0; |
| 11303 | } |
| 11304 | |
| 11305 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11306 | { |
| 11307 | struct alc_spec *spec = codec->spec; |
| 11308 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11309 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11310 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11311 | unsigned int dac_vol1, dac_vol2; |
| 11312 | |
| 11313 | if (speaker_nid) { |
| 11314 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11315 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11316 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11317 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11318 | AMP_IN_UNMUTE(1)); |
| 11319 | snd_hda_codec_write(codec, 0x10, 0, |
| 11320 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11321 | AMP_IN_UNMUTE(1)); |
| 11322 | } else { |
| 11323 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11324 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11325 | snd_hda_codec_write(codec, 0x10, 0, |
| 11326 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11327 | } |
| 11328 | |
| 11329 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11330 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11331 | dac_vol2 = AMP_OUT_ZERO; |
| 11332 | else if (line_nid == 0x15) |
| 11333 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11334 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11335 | dac_vol2 = AMP_OUT_ZERO; |
| 11336 | else if (hp_nid == 0x15) |
| 11337 | dac_vol1 = AMP_OUT_ZERO; |
| 11338 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11339 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11340 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11341 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11342 | |
| 11343 | snd_hda_codec_write(codec, 0x02, 0, |
| 11344 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11345 | snd_hda_codec_write(codec, 0x03, 0, |
| 11346 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11347 | } |
| 11348 | |
| 11349 | /* pcm configuration: identiacal with ALC880 */ |
| 11350 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11351 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11352 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11353 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11354 | |
| 11355 | /* |
| 11356 | * BIOS auto configuration |
| 11357 | */ |
| 11358 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11359 | { |
| 11360 | struct alc_spec *spec = codec->spec; |
| 11361 | int err; |
| 11362 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11363 | |
| 11364 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11365 | alc268_ignore); |
| 11366 | if (err < 0) |
| 11367 | return err; |
| 11368 | if (!spec->autocfg.line_outs) |
| 11369 | return 0; /* can't find valid BIOS pin config */ |
| 11370 | |
| 11371 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11372 | if (err < 0) |
| 11373 | return err; |
| 11374 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11375 | if (err < 0) |
| 11376 | return err; |
| 11377 | |
| 11378 | spec->multiout.max_channels = 2; |
| 11379 | |
| 11380 | /* digital only support output */ |
| 11381 | if (spec->autocfg.dig_out_pin) |
| 11382 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 11383 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 11384 | if (spec->kctls.list) |
| 11385 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11386 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11387 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 11388 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 11389 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11390 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 11391 | spec->num_mux_defs = 1; |
| 11392 | spec->input_mux = &spec->private_imux; |
| 11393 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11394 | err = alc_auto_add_mic_boost(codec); |
| 11395 | if (err < 0) |
| 11396 | return err; |
| 11397 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11398 | return 1; |
| 11399 | } |
| 11400 | |
| 11401 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11402 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11403 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11404 | |
| 11405 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11406 | static void alc268_auto_init(struct hda_codec *codec) |
| 11407 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11408 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11409 | alc268_auto_init_multi_out(codec); |
| 11410 | alc268_auto_init_hp_out(codec); |
| 11411 | alc268_auto_init_mono_speaker_out(codec); |
| 11412 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11413 | if (spec->unsol_event) |
| 11414 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11415 | } |
| 11416 | |
| 11417 | /* |
| 11418 | * configuration and preset |
| 11419 | */ |
| 11420 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11421 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11422 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11423 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11424 | [ALC268_ACER] = "acer", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11425 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11426 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11427 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11428 | #ifdef CONFIG_SND_DEBUG |
| 11429 | [ALC268_TEST] = "test", |
| 11430 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11431 | [ALC268_AUTO] = "auto", |
| 11432 | }; |
| 11433 | |
| 11434 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 11435 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11436 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11437 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11438 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11439 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11440 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 11441 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11442 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11443 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11444 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11445 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11446 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 11447 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11448 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11449 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11450 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11451 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11452 | {} |
| 11453 | }; |
| 11454 | |
| 11455 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11456 | [ALC267_QUANTA_IL1] = { |
| 11457 | .mixers = { alc267_quanta_il1_mixer }, |
| 11458 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11459 | alc267_quanta_il1_verbs }, |
| 11460 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11461 | .dac_nids = alc268_dac_nids, |
| 11462 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11463 | .adc_nids = alc268_adc_nids_alt, |
| 11464 | .hp_nid = 0x03, |
| 11465 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11466 | .channel_mode = alc268_modes, |
| 11467 | .input_mux = &alc268_capture_source, |
| 11468 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 11469 | .init_hook = alc267_quanta_il1_automute, |
| 11470 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11471 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11472 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11473 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11474 | .init_verbs = { alc268_base_init_verbs }, |
| 11475 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11476 | .dac_nids = alc268_dac_nids, |
| 11477 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11478 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11479 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11480 | .hp_nid = 0x03, |
| 11481 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11482 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11483 | .channel_mode = alc268_modes, |
| 11484 | .input_mux = &alc268_capture_source, |
| 11485 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11486 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11487 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11488 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11489 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11490 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11491 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11492 | .dac_nids = alc268_dac_nids, |
| 11493 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11494 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11495 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11496 | .hp_nid = 0x03, |
| 11497 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11498 | .channel_mode = alc268_modes, |
| 11499 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11500 | .unsol_event = alc268_toshiba_unsol_event, |
| 11501 | .init_hook = alc268_toshiba_automute, |
| 11502 | }, |
| 11503 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11504 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 11505 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11506 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11507 | alc268_acer_verbs }, |
| 11508 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11509 | .dac_nids = alc268_dac_nids, |
| 11510 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11511 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11512 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11513 | .hp_nid = 0x02, |
| 11514 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11515 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11516 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11517 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11518 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11519 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11520 | [ALC268_ACER_ASPIRE_ONE] = { |
| 11521 | .mixers = { alc268_acer_aspire_one_mixer, |
| 11522 | alc268_capture_alt_mixer }, |
| 11523 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11524 | alc268_acer_aspire_one_verbs }, |
| 11525 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11526 | .dac_nids = alc268_dac_nids, |
| 11527 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11528 | .adc_nids = alc268_adc_nids_alt, |
| 11529 | .capsrc_nids = alc268_capsrc_nids, |
| 11530 | .hp_nid = 0x03, |
| 11531 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11532 | .channel_mode = alc268_modes, |
| 11533 | .input_mux = &alc268_acer_lc_capture_source, |
| 11534 | .unsol_event = alc268_acer_lc_unsol_event, |
| 11535 | .init_hook = alc268_acer_lc_init_hook, |
| 11536 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11537 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11538 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11539 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11540 | alc268_dell_verbs }, |
| 11541 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11542 | .dac_nids = alc268_dac_nids, |
| 11543 | .hp_nid = 0x02, |
| 11544 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11545 | .channel_mode = alc268_modes, |
| 11546 | .unsol_event = alc268_dell_unsol_event, |
| 11547 | .init_hook = alc268_dell_init_hook, |
| 11548 | .input_mux = &alc268_capture_source, |
| 11549 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11550 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11551 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11552 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11553 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11554 | alc268_toshiba_verbs }, |
| 11555 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11556 | .dac_nids = alc268_dac_nids, |
| 11557 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11558 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11559 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11560 | .hp_nid = 0x03, |
| 11561 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11562 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11563 | .channel_mode = alc268_modes, |
| 11564 | .input_mux = &alc268_capture_source, |
| 11565 | .unsol_event = alc268_toshiba_unsol_event, |
| 11566 | .init_hook = alc268_toshiba_automute |
| 11567 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11568 | #ifdef CONFIG_SND_DEBUG |
| 11569 | [ALC268_TEST] = { |
| 11570 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 11571 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11572 | alc268_volume_init_verbs }, |
| 11573 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11574 | .dac_nids = alc268_dac_nids, |
| 11575 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11576 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11577 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11578 | .hp_nid = 0x03, |
| 11579 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11580 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11581 | .channel_mode = alc268_modes, |
| 11582 | .input_mux = &alc268_capture_source, |
| 11583 | }, |
| 11584 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11585 | }; |
| 11586 | |
| 11587 | static int patch_alc268(struct hda_codec *codec) |
| 11588 | { |
| 11589 | struct alc_spec *spec; |
| 11590 | int board_config; |
| 11591 | int err; |
| 11592 | |
| 11593 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 11594 | if (spec == NULL) |
| 11595 | return -ENOMEM; |
| 11596 | |
| 11597 | codec->spec = spec; |
| 11598 | |
| 11599 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 11600 | alc268_models, |
| 11601 | alc268_cfg_tbl); |
| 11602 | |
| 11603 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 11604 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 11605 | "trying auto-probe from BIOS...\n"); |
| 11606 | board_config = ALC268_AUTO; |
| 11607 | } |
| 11608 | |
| 11609 | if (board_config == ALC268_AUTO) { |
| 11610 | /* automatic parse from the BIOS config */ |
| 11611 | err = alc268_parse_auto_config(codec); |
| 11612 | if (err < 0) { |
| 11613 | alc_free(codec); |
| 11614 | return err; |
| 11615 | } else if (!err) { |
| 11616 | printk(KERN_INFO |
| 11617 | "hda_codec: Cannot set up configuration " |
| 11618 | "from BIOS. Using base mode...\n"); |
| 11619 | board_config = ALC268_3ST; |
| 11620 | } |
| 11621 | } |
| 11622 | |
| 11623 | if (board_config != ALC268_AUTO) |
| 11624 | setup_preset(spec, &alc268_presets[board_config]); |
| 11625 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11626 | if (codec->vendor_id == 0x10ec0267) { |
| 11627 | spec->stream_name_analog = "ALC267 Analog"; |
| 11628 | spec->stream_name_digital = "ALC267 Digital"; |
| 11629 | } else { |
| 11630 | spec->stream_name_analog = "ALC268 Analog"; |
| 11631 | spec->stream_name_digital = "ALC268 Digital"; |
| 11632 | } |
| 11633 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11634 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 11635 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11636 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11637 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11638 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 11639 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11640 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 11641 | /* override the amp caps for beep generator */ |
| 11642 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 11643 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 11644 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 11645 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 11646 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 11647 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11648 | if (!spec->adc_nids && spec->input_mux) { |
| 11649 | /* check whether NID 0x07 is valid */ |
| 11650 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11651 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11652 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11653 | /* get type */ |
| 11654 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 11655 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11656 | spec->adc_nids = alc268_adc_nids_alt; |
| 11657 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 11658 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11659 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11660 | spec->num_mixers++; |
| 11661 | } else { |
| 11662 | spec->adc_nids = alc268_adc_nids; |
| 11663 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 11664 | spec->mixers[spec->num_mixers] = |
| 11665 | alc268_capture_mixer; |
| 11666 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11667 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11668 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11669 | /* set default input source */ |
| 11670 | for (i = 0; i < spec->num_adc_nids; i++) |
| 11671 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 11672 | 0, AC_VERB_SET_CONNECT_SEL, |
| 11673 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11674 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11675 | |
| 11676 | spec->vmaster_nid = 0x02; |
| 11677 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11678 | codec->patch_ops = alc_patch_ops; |
| 11679 | if (board_config == ALC268_AUTO) |
| 11680 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11681 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11682 | return 0; |
| 11683 | } |
| 11684 | |
| 11685 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11686 | * ALC269 channel source setting (2 channel) |
| 11687 | */ |
| 11688 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 11689 | |
| 11690 | #define alc269_dac_nids alc260_dac_nids |
| 11691 | |
| 11692 | static hda_nid_t alc269_adc_nids[1] = { |
| 11693 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11694 | 0x08, |
| 11695 | }; |
| 11696 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 11697 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 11698 | 0x23, |
| 11699 | }; |
| 11700 | |
| 11701 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 11702 | * not a mux! |
| 11703 | */ |
| 11704 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11705 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 11706 | .num_items = 2, |
| 11707 | .items = { |
| 11708 | { "i-Mic", 0x5 }, |
| 11709 | { "e-Mic", 0x0 }, |
| 11710 | }, |
| 11711 | }; |
| 11712 | |
| 11713 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 11714 | .num_items = 2, |
| 11715 | .items = { |
| 11716 | { "i-Mic", 0x1 }, |
| 11717 | { "e-Mic", 0x0 }, |
| 11718 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11719 | }; |
| 11720 | |
| 11721 | #define alc269_modes alc260_modes |
| 11722 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 11723 | |
| 11724 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 11725 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11726 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11727 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11728 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11729 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11730 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11731 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11732 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11733 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11734 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11735 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11736 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11737 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11738 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 11739 | { } /* end */ |
| 11740 | }; |
| 11741 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11742 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 11743 | /* output mixer control */ |
| 11744 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11745 | { |
| 11746 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11747 | .name = "Master Playback Switch", |
| 11748 | .info = snd_hda_mixer_amp_switch_info, |
| 11749 | .get = snd_hda_mixer_amp_switch_get, |
| 11750 | .put = alc268_acer_master_sw_put, |
| 11751 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11752 | }, |
| 11753 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11754 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11755 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11756 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11757 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11758 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11759 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11760 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11761 | { } |
| 11762 | }; |
| 11763 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11764 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 11765 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 11766 | .ops = &snd_hda_bind_vol, |
| 11767 | .values = { |
| 11768 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11769 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11770 | 0 |
| 11771 | }, |
| 11772 | }; |
| 11773 | |
| 11774 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 11775 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11776 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 11777 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11778 | { } /* end */ |
| 11779 | }; |
| 11780 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11781 | /* capture mixer elements */ |
| 11782 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11783 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11784 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11785 | { |
| 11786 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11787 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11788 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11789 | */ |
| 11790 | /* .name = "Capture Source", */ |
| 11791 | .name = "Input Source", |
| 11792 | .count = 1, |
| 11793 | .info = alc_mux_enum_info, |
| 11794 | .get = alc_mux_enum_get, |
| 11795 | .put = alc_mux_enum_put, |
| 11796 | }, |
| 11797 | { } /* end */ |
| 11798 | }; |
| 11799 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11800 | /* capture mixer elements */ |
| 11801 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 11802 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11803 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11804 | { } /* end */ |
| 11805 | }; |
| 11806 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11807 | /* beep control */ |
| 11808 | static struct snd_kcontrol_new alc269_beep_mixer[] = { |
| 11809 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11810 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
| 11811 | { } /* end */ |
| 11812 | }; |
| 11813 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11814 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 11815 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11816 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11817 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11818 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11819 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11820 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11821 | { } |
| 11822 | }; |
| 11823 | |
| 11824 | /* toggle speaker-output according to the hp-jack state */ |
| 11825 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 11826 | { |
| 11827 | unsigned int present; |
| 11828 | unsigned char bits; |
| 11829 | |
| 11830 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11831 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11832 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11833 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11834 | AMP_IN_MUTE(0), bits); |
| 11835 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11836 | AMP_IN_MUTE(0), bits); |
| 11837 | |
| 11838 | snd_hda_codec_write(codec, 0x20, 0, |
| 11839 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11840 | snd_hda_codec_write(codec, 0x20, 0, |
| 11841 | AC_VERB_SET_PROC_COEF, 0x680); |
| 11842 | |
| 11843 | snd_hda_codec_write(codec, 0x20, 0, |
| 11844 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11845 | snd_hda_codec_write(codec, 0x20, 0, |
| 11846 | AC_VERB_SET_PROC_COEF, 0x480); |
| 11847 | } |
| 11848 | |
| 11849 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 11850 | { |
| 11851 | unsigned int present; |
| 11852 | |
| 11853 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11854 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11855 | snd_hda_codec_write(codec, 0x23, 0, |
| 11856 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 11857 | } |
| 11858 | |
| 11859 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 11860 | unsigned int res) |
| 11861 | { |
| 11862 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11863 | alc269_quanta_fl1_speaker_automute(codec); |
| 11864 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11865 | alc269_quanta_fl1_mic_automute(codec); |
| 11866 | } |
| 11867 | |
| 11868 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 11869 | { |
| 11870 | alc269_quanta_fl1_speaker_automute(codec); |
| 11871 | alc269_quanta_fl1_mic_automute(codec); |
| 11872 | } |
| 11873 | |
| 11874 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 11875 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11876 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 11877 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11878 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 11879 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11880 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11881 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11882 | {} |
| 11883 | }; |
| 11884 | |
| 11885 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 11886 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11887 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11888 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11889 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 11890 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11891 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11892 | {} |
| 11893 | }; |
| 11894 | |
| 11895 | /* toggle speaker-output according to the hp-jack state */ |
| 11896 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 11897 | { |
| 11898 | unsigned int present; |
| 11899 | unsigned char bits; |
| 11900 | |
| 11901 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11902 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11903 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11904 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11905 | AMP_IN_MUTE(0), bits); |
| 11906 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11907 | AMP_IN_MUTE(0), bits); |
| 11908 | } |
| 11909 | |
| 11910 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 11911 | { |
| 11912 | unsigned int present; |
| 11913 | |
| 11914 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11915 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11916 | snd_hda_codec_write(codec, 0x23, 0, |
| 11917 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 11918 | } |
| 11919 | |
| 11920 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 11921 | { |
| 11922 | unsigned int present; |
| 11923 | |
| 11924 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11925 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11926 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11927 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 11928 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11929 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 11930 | } |
| 11931 | |
| 11932 | /* unsolicited event for HP jack sensing */ |
| 11933 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 11934 | unsigned int res) |
| 11935 | { |
| 11936 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11937 | alc269_speaker_automute(codec); |
| 11938 | |
| 11939 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11940 | alc269_eeepc_dmic_automute(codec); |
| 11941 | } |
| 11942 | |
| 11943 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 11944 | { |
| 11945 | alc269_speaker_automute(codec); |
| 11946 | alc269_eeepc_dmic_automute(codec); |
| 11947 | } |
| 11948 | |
| 11949 | /* unsolicited event for HP jack sensing */ |
| 11950 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 11951 | unsigned int res) |
| 11952 | { |
| 11953 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11954 | alc269_speaker_automute(codec); |
| 11955 | |
| 11956 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11957 | alc269_eeepc_amic_automute(codec); |
| 11958 | } |
| 11959 | |
| 11960 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 11961 | { |
| 11962 | alc269_speaker_automute(codec); |
| 11963 | alc269_eeepc_amic_automute(codec); |
| 11964 | } |
| 11965 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11966 | /* |
| 11967 | * generic initialization of ADC, input mixers and output mixers |
| 11968 | */ |
| 11969 | static struct hda_verb alc269_init_verbs[] = { |
| 11970 | /* |
| 11971 | * Unmute ADC0 and set the default input to mic-in |
| 11972 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11973 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11974 | |
| 11975 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 11976 | * analog-loopback mixer widget |
| 11977 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11978 | * front panel mic (mic 2) |
| 11979 | */ |
| 11980 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 11981 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11982 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11983 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11984 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11985 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11986 | |
| 11987 | /* |
| 11988 | * Set up output mixers (0x0c - 0x0e) |
| 11989 | */ |
| 11990 | /* set vol=0 to output mixers */ |
| 11991 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11992 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11993 | |
| 11994 | /* set up input amps for analog loopback */ |
| 11995 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11996 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11997 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11998 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11999 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12000 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12001 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12002 | |
| 12003 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12004 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12005 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12006 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12007 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12008 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12009 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12010 | |
| 12011 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12012 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12013 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12014 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12015 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12016 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12017 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12018 | |
| 12019 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12020 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12021 | |
| 12022 | /* FIXME: use matrix-type input source selection */ |
| 12023 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12024 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12025 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12026 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12027 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12028 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12029 | |
| 12030 | /* set EAPD */ |
| 12031 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12032 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12033 | { } |
| 12034 | }; |
| 12035 | |
| 12036 | /* add playback controls from the parsed DAC table */ |
| 12037 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12038 | const struct auto_pin_cfg *cfg) |
| 12039 | { |
| 12040 | hda_nid_t nid; |
| 12041 | int err; |
| 12042 | |
| 12043 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12044 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12045 | spec->multiout.dac_nids[0] = 2; |
| 12046 | |
| 12047 | nid = cfg->line_out_pins[0]; |
| 12048 | if (nid) { |
| 12049 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12050 | "Front Playback Volume", |
| 12051 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12052 | if (err < 0) |
| 12053 | return err; |
| 12054 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12055 | "Front Playback Switch", |
| 12056 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12057 | if (err < 0) |
| 12058 | return err; |
| 12059 | } |
| 12060 | |
| 12061 | nid = cfg->speaker_pins[0]; |
| 12062 | if (nid) { |
| 12063 | if (!cfg->line_out_pins[0]) { |
| 12064 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12065 | "Speaker Playback Volume", |
| 12066 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12067 | HDA_OUTPUT)); |
| 12068 | if (err < 0) |
| 12069 | return err; |
| 12070 | } |
| 12071 | if (nid == 0x16) { |
| 12072 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12073 | "Speaker Playback Switch", |
| 12074 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12075 | HDA_OUTPUT)); |
| 12076 | if (err < 0) |
| 12077 | return err; |
| 12078 | } else { |
| 12079 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12080 | "Speaker Playback Switch", |
| 12081 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12082 | HDA_OUTPUT)); |
| 12083 | if (err < 0) |
| 12084 | return err; |
| 12085 | } |
| 12086 | } |
| 12087 | nid = cfg->hp_pins[0]; |
| 12088 | if (nid) { |
| 12089 | /* spec->multiout.hp_nid = 2; */ |
| 12090 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12091 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12092 | "Headphone Playback Volume", |
| 12093 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12094 | HDA_OUTPUT)); |
| 12095 | if (err < 0) |
| 12096 | return err; |
| 12097 | } |
| 12098 | if (nid == 0x16) { |
| 12099 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12100 | "Headphone Playback Switch", |
| 12101 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12102 | HDA_OUTPUT)); |
| 12103 | if (err < 0) |
| 12104 | return err; |
| 12105 | } else { |
| 12106 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12107 | "Headphone Playback Switch", |
| 12108 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12109 | HDA_OUTPUT)); |
| 12110 | if (err < 0) |
| 12111 | return err; |
| 12112 | } |
| 12113 | } |
| 12114 | return 0; |
| 12115 | } |
| 12116 | |
| 12117 | #define alc269_auto_create_analog_input_ctls \ |
| 12118 | alc880_auto_create_analog_input_ctls |
| 12119 | |
| 12120 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12121 | #define alc269_loopbacks alc880_loopbacks |
| 12122 | #endif |
| 12123 | |
| 12124 | /* pcm configuration: identiacal with ALC880 */ |
| 12125 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12126 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12127 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12128 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12129 | |
| 12130 | /* |
| 12131 | * BIOS auto configuration |
| 12132 | */ |
| 12133 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12134 | { |
| 12135 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12136 | int i, err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12137 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12138 | |
| 12139 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12140 | alc269_ignore); |
| 12141 | if (err < 0) |
| 12142 | return err; |
| 12143 | |
| 12144 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12145 | if (err < 0) |
| 12146 | return err; |
| 12147 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12148 | if (err < 0) |
| 12149 | return err; |
| 12150 | |
| 12151 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12152 | |
| 12153 | if (spec->autocfg.dig_out_pin) |
| 12154 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12155 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 12156 | if (spec->kctls.list) |
| 12157 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12158 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12159 | /* create a beep mixer control if the pin 0x1d isn't assigned */ |
| 12160 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) |
| 12161 | if (spec->autocfg.input_pins[i] == 0x1d) |
| 12162 | break; |
| 12163 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) |
| 12164 | spec->mixers[spec->num_mixers++] = alc269_beep_mixer; |
| 12165 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12166 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 12167 | spec->num_mux_defs = 1; |
| 12168 | spec->input_mux = &spec->private_imux; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12169 | /* set default input source */ |
| 12170 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12171 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12172 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12173 | |
| 12174 | err = alc_auto_add_mic_boost(codec); |
| 12175 | if (err < 0) |
| 12176 | return err; |
| 12177 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12178 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 12179 | spec->num_mixers++; |
| 12180 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12181 | return 1; |
| 12182 | } |
| 12183 | |
| 12184 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12185 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12186 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12187 | |
| 12188 | |
| 12189 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12190 | static void alc269_auto_init(struct hda_codec *codec) |
| 12191 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12192 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12193 | alc269_auto_init_multi_out(codec); |
| 12194 | alc269_auto_init_hp_out(codec); |
| 12195 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12196 | if (spec->unsol_event) |
| 12197 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12198 | } |
| 12199 | |
| 12200 | /* |
| 12201 | * configuration and preset |
| 12202 | */ |
| 12203 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12204 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12205 | [ALC269_QUANTA_FL1] = "quanta", |
| 12206 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
| 12207 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12208 | }; |
| 12209 | |
| 12210 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12211 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12212 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12213 | ALC269_ASUS_EEEPC_P703), |
| 12214 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12215 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12216 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12217 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12218 | {} |
| 12219 | }; |
| 12220 | |
| 12221 | static struct alc_config_preset alc269_presets[] = { |
| 12222 | [ALC269_BASIC] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12223 | .mixers = { alc269_base_mixer, alc269_capture_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12224 | .init_verbs = { alc269_init_verbs }, |
| 12225 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12226 | .dac_nids = alc269_dac_nids, |
| 12227 | .hp_nid = 0x03, |
| 12228 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12229 | .channel_mode = alc269_modes, |
| 12230 | .input_mux = &alc269_capture_source, |
| 12231 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12232 | [ALC269_QUANTA_FL1] = { |
| 12233 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12234 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12235 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12236 | .dac_nids = alc269_dac_nids, |
| 12237 | .hp_nid = 0x03, |
| 12238 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12239 | .channel_mode = alc269_modes, |
| 12240 | .input_mux = &alc269_capture_source, |
| 12241 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12242 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12243 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12244 | [ALC269_ASUS_EEEPC_P703] = { |
| 12245 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, |
| 12246 | .init_verbs = { alc269_init_verbs, |
| 12247 | alc269_eeepc_amic_init_verbs }, |
| 12248 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12249 | .dac_nids = alc269_dac_nids, |
| 12250 | .hp_nid = 0x03, |
| 12251 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12252 | .channel_mode = alc269_modes, |
| 12253 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12254 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12255 | .init_hook = alc269_eeepc_amic_inithook, |
| 12256 | }, |
| 12257 | [ALC269_ASUS_EEEPC_P901] = { |
| 12258 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer}, |
| 12259 | .init_verbs = { alc269_init_verbs, |
| 12260 | alc269_eeepc_dmic_init_verbs }, |
| 12261 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12262 | .dac_nids = alc269_dac_nids, |
| 12263 | .hp_nid = 0x03, |
| 12264 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12265 | .channel_mode = alc269_modes, |
| 12266 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12267 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12268 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12269 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12270 | }; |
| 12271 | |
| 12272 | static int patch_alc269(struct hda_codec *codec) |
| 12273 | { |
| 12274 | struct alc_spec *spec; |
| 12275 | int board_config; |
| 12276 | int err; |
| 12277 | |
| 12278 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12279 | if (spec == NULL) |
| 12280 | return -ENOMEM; |
| 12281 | |
| 12282 | codec->spec = spec; |
| 12283 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12284 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 12285 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12286 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 12287 | alc269_models, |
| 12288 | alc269_cfg_tbl); |
| 12289 | |
| 12290 | if (board_config < 0) { |
| 12291 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 12292 | "trying auto-probe from BIOS...\n"); |
| 12293 | board_config = ALC269_AUTO; |
| 12294 | } |
| 12295 | |
| 12296 | if (board_config == ALC269_AUTO) { |
| 12297 | /* automatic parse from the BIOS config */ |
| 12298 | err = alc269_parse_auto_config(codec); |
| 12299 | if (err < 0) { |
| 12300 | alc_free(codec); |
| 12301 | return err; |
| 12302 | } else if (!err) { |
| 12303 | printk(KERN_INFO |
| 12304 | "hda_codec: Cannot set up configuration " |
| 12305 | "from BIOS. Using base mode...\n"); |
| 12306 | board_config = ALC269_BASIC; |
| 12307 | } |
| 12308 | } |
| 12309 | |
| 12310 | if (board_config != ALC269_AUTO) |
| 12311 | setup_preset(spec, &alc269_presets[board_config]); |
| 12312 | |
| 12313 | spec->stream_name_analog = "ALC269 Analog"; |
| 12314 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 12315 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 12316 | |
| 12317 | spec->stream_name_digital = "ALC269 Digital"; |
| 12318 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 12319 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 12320 | |
| 12321 | spec->adc_nids = alc269_adc_nids; |
| 12322 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12323 | spec->capsrc_nids = alc269_capsrc_nids; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12324 | |
| 12325 | codec->patch_ops = alc_patch_ops; |
| 12326 | if (board_config == ALC269_AUTO) |
| 12327 | spec->init_hook = alc269_auto_init; |
| 12328 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12329 | if (!spec->loopback.amplist) |
| 12330 | spec->loopback.amplist = alc269_loopbacks; |
| 12331 | #endif |
| 12332 | |
| 12333 | return 0; |
| 12334 | } |
| 12335 | |
| 12336 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12337 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 12338 | */ |
| 12339 | |
| 12340 | /* |
| 12341 | * set the path ways for 2 channel output |
| 12342 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 12343 | */ |
| 12344 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 12345 | /* set pin widget 1Ah (line in) for input */ |
| 12346 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12347 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12348 | * the vref |
| 12349 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12350 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12351 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12352 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12353 | #if 0 |
| 12354 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12355 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12356 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12357 | { } /* end */ |
| 12358 | }; |
| 12359 | /* |
| 12360 | * 6ch mode |
| 12361 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 12362 | */ |
| 12363 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 12364 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12365 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12366 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12367 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12368 | |
| 12369 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12370 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12371 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12372 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12373 | #if 0 |
| 12374 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12375 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12376 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12377 | { } /* end */ |
| 12378 | }; |
| 12379 | |
| 12380 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 12381 | { 2, alc861_threestack_ch2_init }, |
| 12382 | { 6, alc861_threestack_ch6_init }, |
| 12383 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12384 | /* Set mic1 as input and unmute the mixer */ |
| 12385 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 12386 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12387 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12388 | { } /* end */ |
| 12389 | }; |
| 12390 | /* Set mic1 as output and mute mixer */ |
| 12391 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 12392 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12393 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12394 | { } /* end */ |
| 12395 | }; |
| 12396 | |
| 12397 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 12398 | { 2, alc861_uniwill_m31_ch2_init }, |
| 12399 | { 4, alc861_uniwill_m31_ch4_init }, |
| 12400 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12401 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12402 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 12403 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 12404 | /* set pin widget 1Ah (line in) for input */ |
| 12405 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12406 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12407 | * the vref |
| 12408 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12409 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12410 | |
| 12411 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12412 | #if 0 |
| 12413 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12414 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12415 | #endif |
| 12416 | { } /* end */ |
| 12417 | }; |
| 12418 | /* Set mic1 nad line-in as output and mute mixer */ |
| 12419 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 12420 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12421 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12422 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12423 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12424 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12425 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12426 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12427 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12428 | |
| 12429 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12430 | #if 0 |
| 12431 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12432 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12433 | #endif |
| 12434 | { } /* end */ |
| 12435 | }; |
| 12436 | |
| 12437 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 12438 | { 2, alc861_asus_ch2_init }, |
| 12439 | { 6, alc861_asus_ch6_init }, |
| 12440 | }; |
| 12441 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12442 | /* patch-ALC861 */ |
| 12443 | |
| 12444 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 12445 | /* output mixer control */ |
| 12446 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12447 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12448 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12449 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12450 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12451 | |
| 12452 | /*Input mixer control */ |
| 12453 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12454 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12455 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12456 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12457 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12458 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12459 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12460 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12461 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12462 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12463 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12464 | /* Capture mixer control */ |
| 12465 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12466 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12467 | { |
| 12468 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12469 | .name = "Capture Source", |
| 12470 | .count = 1, |
| 12471 | .info = alc_mux_enum_info, |
| 12472 | .get = alc_mux_enum_get, |
| 12473 | .put = alc_mux_enum_put, |
| 12474 | }, |
| 12475 | { } /* end */ |
| 12476 | }; |
| 12477 | |
| 12478 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 12479 | /* output mixer control */ |
| 12480 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12481 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12482 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12483 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12484 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12485 | |
| 12486 | /* Input mixer control */ |
| 12487 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12488 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12489 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12490 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12491 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12492 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12493 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12494 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12495 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12496 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12497 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12498 | /* Capture mixer control */ |
| 12499 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12500 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12501 | { |
| 12502 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12503 | .name = "Capture Source", |
| 12504 | .count = 1, |
| 12505 | .info = alc_mux_enum_info, |
| 12506 | .get = alc_mux_enum_get, |
| 12507 | .put = alc_mux_enum_put, |
| 12508 | }, |
| 12509 | { |
| 12510 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12511 | .name = "Channel Mode", |
| 12512 | .info = alc_ch_mode_info, |
| 12513 | .get = alc_ch_mode_get, |
| 12514 | .put = alc_ch_mode_put, |
| 12515 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 12516 | }, |
| 12517 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12518 | }; |
| 12519 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12520 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12521 | /* output mixer control */ |
| 12522 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12523 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12524 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12525 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12526 | /*Capture mixer control */ |
| 12527 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12528 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12529 | { |
| 12530 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12531 | .name = "Capture Source", |
| 12532 | .count = 1, |
| 12533 | .info = alc_mux_enum_info, |
| 12534 | .get = alc_mux_enum_get, |
| 12535 | .put = alc_mux_enum_put, |
| 12536 | }, |
| 12537 | |
| 12538 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12539 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12540 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12541 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 12542 | /* output mixer control */ |
| 12543 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12544 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12545 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12546 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12547 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12548 | |
| 12549 | /* Input mixer control */ |
| 12550 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12551 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12552 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12553 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12554 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12555 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12556 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12557 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12558 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12559 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12560 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12561 | /* Capture mixer control */ |
| 12562 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12563 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12564 | { |
| 12565 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12566 | .name = "Capture Source", |
| 12567 | .count = 1, |
| 12568 | .info = alc_mux_enum_info, |
| 12569 | .get = alc_mux_enum_get, |
| 12570 | .put = alc_mux_enum_put, |
| 12571 | }, |
| 12572 | { |
| 12573 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12574 | .name = "Channel Mode", |
| 12575 | .info = alc_ch_mode_info, |
| 12576 | .get = alc_ch_mode_get, |
| 12577 | .put = alc_ch_mode_put, |
| 12578 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12579 | }, |
| 12580 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12581 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12582 | |
| 12583 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 12584 | /* output mixer control */ |
| 12585 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12586 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12587 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12588 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12589 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12590 | |
| 12591 | /* Input mixer control */ |
| 12592 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12593 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12594 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12595 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12596 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12597 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12598 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12599 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12600 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12601 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 12602 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12603 | /* Capture mixer control */ |
| 12604 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12605 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12606 | { |
| 12607 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12608 | .name = "Capture Source", |
| 12609 | .count = 1, |
| 12610 | .info = alc_mux_enum_info, |
| 12611 | .get = alc_mux_enum_get, |
| 12612 | .put = alc_mux_enum_put, |
| 12613 | }, |
| 12614 | { |
| 12615 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12616 | .name = "Channel Mode", |
| 12617 | .info = alc_ch_mode_info, |
| 12618 | .get = alc_ch_mode_get, |
| 12619 | .put = alc_ch_mode_put, |
| 12620 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 12621 | }, |
| 12622 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12623 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12624 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12625 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12626 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12627 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12628 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12629 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12630 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12631 | { } |
| 12632 | }; |
| 12633 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12634 | /* |
| 12635 | * generic initialization of ADC, input mixers and output mixers |
| 12636 | */ |
| 12637 | static struct hda_verb alc861_base_init_verbs[] = { |
| 12638 | /* |
| 12639 | * Unmute ADC0 and set the default input to mic-in |
| 12640 | */ |
| 12641 | /* port-A for surround (rear panel) */ |
| 12642 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12643 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12644 | /* port-B for mic-in (rear panel) with vref */ |
| 12645 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12646 | /* port-C for line-in (rear panel) */ |
| 12647 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12648 | /* port-D for Front */ |
| 12649 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12650 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12651 | /* port-E for HP out (front panel) */ |
| 12652 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12653 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12654 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12655 | /* port-F for mic-in (front panel) with vref */ |
| 12656 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12657 | /* port-G for CLFE (rear panel) */ |
| 12658 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12659 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12660 | /* port-H for side (rear panel) */ |
| 12661 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12662 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12663 | /* CD-in */ |
| 12664 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12665 | /* route front mic to ADC1*/ |
| 12666 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12667 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12668 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12669 | /* Unmute DAC0~3 & spdif out*/ |
| 12670 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12671 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12672 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12673 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12674 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12675 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12676 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12677 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12678 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12679 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12680 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12681 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12682 | /* Unmute Stereo Mixer 15 */ |
| 12683 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12684 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12685 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12686 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12687 | |
| 12688 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12689 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12690 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12691 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12692 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12693 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12694 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12695 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12696 | /* hp used DAC 3 (Front) */ |
| 12697 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12698 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12699 | |
| 12700 | { } |
| 12701 | }; |
| 12702 | |
| 12703 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 12704 | /* |
| 12705 | * Unmute ADC0 and set the default input to mic-in |
| 12706 | */ |
| 12707 | /* port-A for surround (rear panel) */ |
| 12708 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12709 | /* port-B for mic-in (rear panel) with vref */ |
| 12710 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12711 | /* port-C for line-in (rear panel) */ |
| 12712 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12713 | /* port-D for Front */ |
| 12714 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12715 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12716 | /* port-E for HP out (front panel) */ |
| 12717 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12718 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12719 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12720 | /* port-F for mic-in (front panel) with vref */ |
| 12721 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12722 | /* port-G for CLFE (rear panel) */ |
| 12723 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12724 | /* port-H for side (rear panel) */ |
| 12725 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12726 | /* CD-in */ |
| 12727 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12728 | /* route front mic to ADC1*/ |
| 12729 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12730 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12731 | /* Unmute DAC0~3 & spdif out*/ |
| 12732 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12733 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12734 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12735 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12736 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12737 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12738 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12739 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12740 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12741 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12742 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12743 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12744 | /* Unmute Stereo Mixer 15 */ |
| 12745 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12746 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12747 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12748 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12749 | |
| 12750 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12751 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12752 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12753 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12754 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12755 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12756 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12757 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12758 | /* hp used DAC 3 (Front) */ |
| 12759 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12760 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12761 | { } |
| 12762 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12763 | |
| 12764 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 12765 | /* |
| 12766 | * Unmute ADC0 and set the default input to mic-in |
| 12767 | */ |
| 12768 | /* port-A for surround (rear panel) */ |
| 12769 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12770 | /* port-B for mic-in (rear panel) with vref */ |
| 12771 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12772 | /* port-C for line-in (rear panel) */ |
| 12773 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12774 | /* port-D for Front */ |
| 12775 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12776 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12777 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12778 | /* this has to be set to VREF80 */ |
| 12779 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12780 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12781 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12782 | /* port-F for mic-in (front panel) with vref */ |
| 12783 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12784 | /* port-G for CLFE (rear panel) */ |
| 12785 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12786 | /* port-H for side (rear panel) */ |
| 12787 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12788 | /* CD-in */ |
| 12789 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12790 | /* route front mic to ADC1*/ |
| 12791 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12792 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12793 | /* Unmute DAC0~3 & spdif out*/ |
| 12794 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12795 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12796 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12797 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12798 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12799 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12800 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12801 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12802 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12803 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12804 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12805 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12806 | /* Unmute Stereo Mixer 15 */ |
| 12807 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12808 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12809 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12810 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12811 | |
| 12812 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12813 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12814 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12815 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12816 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12817 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12818 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12820 | /* hp used DAC 3 (Front) */ |
| 12821 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12822 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12823 | { } |
| 12824 | }; |
| 12825 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12826 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 12827 | /* |
| 12828 | * Unmute ADC0 and set the default input to mic-in |
| 12829 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12830 | /* port-A for surround (rear panel) |
| 12831 | * according to codec#0 this is the HP jack |
| 12832 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12833 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 12834 | /* route front PCM to HP */ |
| 12835 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12836 | /* port-B for mic-in (rear panel) with vref */ |
| 12837 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12838 | /* port-C for line-in (rear panel) */ |
| 12839 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12840 | /* port-D for Front */ |
| 12841 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12842 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12843 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12844 | /* this has to be set to VREF80 */ |
| 12845 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12846 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12847 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12848 | /* port-F for mic-in (front panel) with vref */ |
| 12849 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12850 | /* port-G for CLFE (rear panel) */ |
| 12851 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12852 | /* port-H for side (rear panel) */ |
| 12853 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12854 | /* CD-in */ |
| 12855 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12856 | /* route front mic to ADC1*/ |
| 12857 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12858 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12859 | /* Unmute DAC0~3 & spdif out*/ |
| 12860 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12861 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12862 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12863 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12864 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12865 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12866 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12867 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12868 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12869 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12870 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12871 | /* Unmute Stereo Mixer 15 */ |
| 12872 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12873 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12875 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12876 | |
| 12877 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12878 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12879 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12880 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12881 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12882 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12883 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12884 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12885 | /* hp used DAC 3 (Front) */ |
| 12886 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12887 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12888 | { } |
| 12889 | }; |
| 12890 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12891 | /* additional init verbs for ASUS laptops */ |
| 12892 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 12893 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 12894 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 12895 | { } |
| 12896 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12897 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12898 | /* |
| 12899 | * generic initialization of ADC, input mixers and output mixers |
| 12900 | */ |
| 12901 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 12902 | /* |
| 12903 | * Unmute ADC0 and set the default input to mic-in |
| 12904 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12905 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12906 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12907 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12908 | /* Unmute DAC0~3 & spdif out*/ |
| 12909 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12910 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12911 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12912 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12913 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12914 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12915 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12916 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12917 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12918 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12919 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12920 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12921 | /* Unmute Stereo Mixer 15 */ |
| 12922 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12923 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12924 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12925 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 12926 | |
| 12927 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12928 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12929 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12930 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12931 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12932 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12933 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12934 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12935 | |
| 12936 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12937 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12938 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12939 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12940 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12941 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12942 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12943 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12944 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12945 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12946 | |
| 12947 | { } |
| 12948 | }; |
| 12949 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12950 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 12951 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12952 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12953 | { } |
| 12954 | }; |
| 12955 | |
| 12956 | /* toggle speaker-output according to the hp-jack state */ |
| 12957 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 12958 | { |
| 12959 | unsigned int present; |
| 12960 | |
| 12961 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 12962 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12963 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 12964 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 12965 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 12966 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12967 | } |
| 12968 | |
| 12969 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 12970 | unsigned int res) |
| 12971 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12972 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12973 | alc861_toshiba_automute(codec); |
| 12974 | } |
| 12975 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12976 | /* pcm configuration: identiacal with ALC880 */ |
| 12977 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 12978 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 12979 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 12980 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 12981 | |
| 12982 | |
| 12983 | #define ALC861_DIGOUT_NID 0x07 |
| 12984 | |
| 12985 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 12986 | { 8, NULL } |
| 12987 | }; |
| 12988 | |
| 12989 | static hda_nid_t alc861_dac_nids[4] = { |
| 12990 | /* front, surround, clfe, side */ |
| 12991 | 0x03, 0x06, 0x05, 0x04 |
| 12992 | }; |
| 12993 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12994 | static hda_nid_t alc660_dac_nids[3] = { |
| 12995 | /* front, clfe, surround */ |
| 12996 | 0x03, 0x05, 0x06 |
| 12997 | }; |
| 12998 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12999 | static hda_nid_t alc861_adc_nids[1] = { |
| 13000 | /* ADC0-2 */ |
| 13001 | 0x08, |
| 13002 | }; |
| 13003 | |
| 13004 | static struct hda_input_mux alc861_capture_source = { |
| 13005 | .num_items = 5, |
| 13006 | .items = { |
| 13007 | { "Mic", 0x0 }, |
| 13008 | { "Front Mic", 0x3 }, |
| 13009 | { "Line", 0x1 }, |
| 13010 | { "CD", 0x4 }, |
| 13011 | { "Mixer", 0x5 }, |
| 13012 | }, |
| 13013 | }; |
| 13014 | |
| 13015 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13016 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13017 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13018 | { |
| 13019 | int i; |
| 13020 | hda_nid_t nid; |
| 13021 | |
| 13022 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13023 | for (i = 0; i < cfg->line_outs; i++) { |
| 13024 | nid = cfg->line_out_pins[i]; |
| 13025 | if (nid) { |
| 13026 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13027 | continue; |
| 13028 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13029 | } |
| 13030 | } |
| 13031 | spec->multiout.num_dacs = cfg->line_outs; |
| 13032 | return 0; |
| 13033 | } |
| 13034 | |
| 13035 | /* add playback controls from the parsed DAC table */ |
| 13036 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13037 | const struct auto_pin_cfg *cfg) |
| 13038 | { |
| 13039 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13040 | static const char *chname[4] = { |
| 13041 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13042 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13043 | hda_nid_t nid; |
| 13044 | int i, idx, err; |
| 13045 | |
| 13046 | for (i = 0; i < cfg->line_outs; i++) { |
| 13047 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13048 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13049 | continue; |
| 13050 | if (nid == 0x05) { |
| 13051 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13052 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13053 | "Center Playback Switch", |
| 13054 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13055 | HDA_OUTPUT)); |
| 13056 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13057 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13058 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13059 | "LFE Playback Switch", |
| 13060 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13061 | HDA_OUTPUT)); |
| 13062 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13063 | return err; |
| 13064 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13065 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13066 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13067 | if (nid == alc861_dac_nids[idx]) |
| 13068 | break; |
| 13069 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13070 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13071 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13072 | HDA_OUTPUT)); |
| 13073 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13074 | return err; |
| 13075 | } |
| 13076 | } |
| 13077 | return 0; |
| 13078 | } |
| 13079 | |
| 13080 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13081 | { |
| 13082 | int err; |
| 13083 | hda_nid_t nid; |
| 13084 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13085 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13086 | return 0; |
| 13087 | |
| 13088 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13089 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13090 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13091 | "Headphone Playback Switch", |
| 13092 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13093 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13094 | return err; |
| 13095 | spec->multiout.hp_nid = nid; |
| 13096 | } |
| 13097 | return 0; |
| 13098 | } |
| 13099 | |
| 13100 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13101 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13102 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13103 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13104 | struct hda_input_mux *imux = &spec->private_imux; |
| 13105 | int i, err, idx, idx1; |
| 13106 | |
| 13107 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13108 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13109 | case 0x0c: |
| 13110 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13111 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13112 | break; |
| 13113 | case 0x0f: |
| 13114 | idx1 = 2; |
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 0x0d: |
| 13118 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13119 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13120 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13121 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13122 | idx1 = 3; |
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; |
| 13125 | case 0x11: |
| 13126 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13127 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13128 | break; |
| 13129 | default: |
| 13130 | continue; |
| 13131 | } |
| 13132 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13133 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13134 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13135 | if (err < 0) |
| 13136 | return err; |
| 13137 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13138 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13139 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13140 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13141 | } |
| 13142 | return 0; |
| 13143 | } |
| 13144 | |
| 13145 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 13146 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13147 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13148 | |
| 13149 | { |
| 13150 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13151 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13152 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13153 | */ |
| 13154 | /* .name = "Capture Source", */ |
| 13155 | .name = "Input Source", |
| 13156 | .count = 1, |
| 13157 | .info = alc_mux_enum_info, |
| 13158 | .get = alc_mux_enum_get, |
| 13159 | .put = alc_mux_enum_put, |
| 13160 | }, |
| 13161 | { } /* end */ |
| 13162 | }; |
| 13163 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13164 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13165 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13166 | int pin_type, int dac_idx) |
| 13167 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13168 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13169 | pin_type); |
| 13170 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13171 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13172 | } |
| 13173 | |
| 13174 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13175 | { |
| 13176 | struct alc_spec *spec = codec->spec; |
| 13177 | int i; |
| 13178 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13179 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13180 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13181 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13182 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13183 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13184 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13185 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13186 | } |
| 13187 | } |
| 13188 | |
| 13189 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13190 | { |
| 13191 | struct alc_spec *spec = codec->spec; |
| 13192 | hda_nid_t pin; |
| 13193 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13194 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13195 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13196 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13197 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13198 | pin = spec->autocfg.speaker_pins[0]; |
| 13199 | if (pin) |
| 13200 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13201 | } |
| 13202 | |
| 13203 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13204 | { |
| 13205 | struct alc_spec *spec = codec->spec; |
| 13206 | int i; |
| 13207 | |
| 13208 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13209 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13210 | if (nid >= 0x0c && nid <= 0x11) { |
| 13211 | snd_hda_codec_write(codec, nid, 0, |
| 13212 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13213 | i <= AUTO_PIN_FRONT_MIC ? |
| 13214 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13215 | } |
| 13216 | } |
| 13217 | } |
| 13218 | |
| 13219 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13220 | /* return 1 if successful, 0 if the proper config is not found, |
| 13221 | * or a negative error code |
| 13222 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13223 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13224 | { |
| 13225 | struct alc_spec *spec = codec->spec; |
| 13226 | int err; |
| 13227 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13228 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13229 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13230 | alc861_ignore); |
| 13231 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13232 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13233 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13234 | return 0; /* can't find valid BIOS pin config */ |
| 13235 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13236 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13237 | if (err < 0) |
| 13238 | return err; |
| 13239 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13240 | if (err < 0) |
| 13241 | return err; |
| 13242 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13243 | if (err < 0) |
| 13244 | return err; |
| 13245 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13246 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13247 | return err; |
| 13248 | |
| 13249 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13250 | |
| 13251 | if (spec->autocfg.dig_out_pin) |
| 13252 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13253 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 13254 | if (spec->kctls.list) |
| 13255 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13256 | |
| 13257 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 13258 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13259 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13260 | spec->input_mux = &spec->private_imux; |
| 13261 | |
| 13262 | spec->adc_nids = alc861_adc_nids; |
| 13263 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 13264 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 13265 | spec->num_mixers++; |
| 13266 | |
| 13267 | return 1; |
| 13268 | } |
| 13269 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13270 | /* additional initialization for auto-configuration model */ |
| 13271 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13272 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13273 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13274 | alc861_auto_init_multi_out(codec); |
| 13275 | alc861_auto_init_hp_out(codec); |
| 13276 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13277 | if (spec->unsol_event) |
| 13278 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13279 | } |
| 13280 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13281 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13282 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13283 | { 0x15, HDA_INPUT, 0 }, |
| 13284 | { 0x15, HDA_INPUT, 1 }, |
| 13285 | { 0x15, HDA_INPUT, 2 }, |
| 13286 | { 0x15, HDA_INPUT, 3 }, |
| 13287 | { } /* end */ |
| 13288 | }; |
| 13289 | #endif |
| 13290 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13291 | |
| 13292 | /* |
| 13293 | * configuration and preset |
| 13294 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13295 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13296 | [ALC861_3ST] = "3stack", |
| 13297 | [ALC660_3ST] = "3stack-660", |
| 13298 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13299 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13300 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 13301 | [ALC861_TOSHIBA] = "toshiba", |
| 13302 | [ALC861_ASUS] = "asus", |
| 13303 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 13304 | [ALC861_AUTO] = "auto", |
| 13305 | }; |
| 13306 | |
| 13307 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 13308 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13309 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13310 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13311 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13312 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 13313 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 13314 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 13315 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 13316 | * Any other models that need this preset? |
| 13317 | */ |
| 13318 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 13319 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 13320 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13321 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 13322 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 13323 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 13324 | /* FIXME: the below seems conflict */ |
| 13325 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 13326 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 13327 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13328 | {} |
| 13329 | }; |
| 13330 | |
| 13331 | static struct alc_config_preset alc861_presets[] = { |
| 13332 | [ALC861_3ST] = { |
| 13333 | .mixers = { alc861_3ST_mixer }, |
| 13334 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13335 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13336 | .dac_nids = alc861_dac_nids, |
| 13337 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13338 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13339 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13340 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13341 | .adc_nids = alc861_adc_nids, |
| 13342 | .input_mux = &alc861_capture_source, |
| 13343 | }, |
| 13344 | [ALC861_3ST_DIG] = { |
| 13345 | .mixers = { alc861_base_mixer }, |
| 13346 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13347 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13348 | .dac_nids = alc861_dac_nids, |
| 13349 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13350 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13351 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13352 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13353 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13354 | .adc_nids = alc861_adc_nids, |
| 13355 | .input_mux = &alc861_capture_source, |
| 13356 | }, |
| 13357 | [ALC861_6ST_DIG] = { |
| 13358 | .mixers = { alc861_base_mixer }, |
| 13359 | .init_verbs = { alc861_base_init_verbs }, |
| 13360 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13361 | .dac_nids = alc861_dac_nids, |
| 13362 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13363 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 13364 | .channel_mode = alc861_8ch_modes, |
| 13365 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13366 | .adc_nids = alc861_adc_nids, |
| 13367 | .input_mux = &alc861_capture_source, |
| 13368 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13369 | [ALC660_3ST] = { |
| 13370 | .mixers = { alc861_3ST_mixer }, |
| 13371 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13372 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 13373 | .dac_nids = alc660_dac_nids, |
| 13374 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13375 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13376 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13377 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13378 | .adc_nids = alc861_adc_nids, |
| 13379 | .input_mux = &alc861_capture_source, |
| 13380 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13381 | [ALC861_UNIWILL_M31] = { |
| 13382 | .mixers = { alc861_uniwill_m31_mixer }, |
| 13383 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 13384 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13385 | .dac_nids = alc861_dac_nids, |
| 13386 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13387 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13388 | .channel_mode = alc861_uniwill_m31_modes, |
| 13389 | .need_dac_fix = 1, |
| 13390 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13391 | .adc_nids = alc861_adc_nids, |
| 13392 | .input_mux = &alc861_capture_source, |
| 13393 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13394 | [ALC861_TOSHIBA] = { |
| 13395 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13396 | .init_verbs = { alc861_base_init_verbs, |
| 13397 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13398 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13399 | .dac_nids = alc861_dac_nids, |
| 13400 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13401 | .channel_mode = alc883_3ST_2ch_modes, |
| 13402 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13403 | .adc_nids = alc861_adc_nids, |
| 13404 | .input_mux = &alc861_capture_source, |
| 13405 | .unsol_event = alc861_toshiba_unsol_event, |
| 13406 | .init_hook = alc861_toshiba_automute, |
| 13407 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13408 | [ALC861_ASUS] = { |
| 13409 | .mixers = { alc861_asus_mixer }, |
| 13410 | .init_verbs = { alc861_asus_init_verbs }, |
| 13411 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13412 | .dac_nids = alc861_dac_nids, |
| 13413 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13414 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 13415 | .channel_mode = alc861_asus_modes, |
| 13416 | .need_dac_fix = 1, |
| 13417 | .hp_nid = 0x06, |
| 13418 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13419 | .adc_nids = alc861_adc_nids, |
| 13420 | .input_mux = &alc861_capture_source, |
| 13421 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13422 | [ALC861_ASUS_LAPTOP] = { |
| 13423 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 13424 | .init_verbs = { alc861_asus_init_verbs, |
| 13425 | alc861_asus_laptop_init_verbs }, |
| 13426 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13427 | .dac_nids = alc861_dac_nids, |
| 13428 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13429 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13430 | .channel_mode = alc883_3ST_2ch_modes, |
| 13431 | .need_dac_fix = 1, |
| 13432 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13433 | .adc_nids = alc861_adc_nids, |
| 13434 | .input_mux = &alc861_capture_source, |
| 13435 | }, |
| 13436 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13437 | |
| 13438 | |
| 13439 | static int patch_alc861(struct hda_codec *codec) |
| 13440 | { |
| 13441 | struct alc_spec *spec; |
| 13442 | int board_config; |
| 13443 | int err; |
| 13444 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 13445 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13446 | if (spec == NULL) |
| 13447 | return -ENOMEM; |
| 13448 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13449 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13450 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13451 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 13452 | alc861_models, |
| 13453 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13454 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13455 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13456 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 13457 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13458 | board_config = ALC861_AUTO; |
| 13459 | } |
| 13460 | |
| 13461 | if (board_config == ALC861_AUTO) { |
| 13462 | /* automatic parse from the BIOS config */ |
| 13463 | err = alc861_parse_auto_config(codec); |
| 13464 | if (err < 0) { |
| 13465 | alc_free(codec); |
| 13466 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13467 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13468 | printk(KERN_INFO |
| 13469 | "hda_codec: Cannot set up configuration " |
| 13470 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13471 | board_config = ALC861_3ST_DIG; |
| 13472 | } |
| 13473 | } |
| 13474 | |
| 13475 | if (board_config != ALC861_AUTO) |
| 13476 | setup_preset(spec, &alc861_presets[board_config]); |
| 13477 | |
| 13478 | spec->stream_name_analog = "ALC861 Analog"; |
| 13479 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 13480 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 13481 | |
| 13482 | spec->stream_name_digital = "ALC861 Digital"; |
| 13483 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 13484 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 13485 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13486 | spec->vmaster_nid = 0x03; |
| 13487 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13488 | codec->patch_ops = alc_patch_ops; |
| 13489 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13490 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13491 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13492 | if (!spec->loopback.amplist) |
| 13493 | spec->loopback.amplist = alc861_loopbacks; |
| 13494 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13495 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13496 | return 0; |
| 13497 | } |
| 13498 | |
| 13499 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13500 | * ALC861-VD support |
| 13501 | * |
| 13502 | * Based on ALC882 |
| 13503 | * |
| 13504 | * In addition, an independent DAC |
| 13505 | */ |
| 13506 | #define ALC861VD_DIGOUT_NID 0x06 |
| 13507 | |
| 13508 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 13509 | /* front, surr, clfe, side surr */ |
| 13510 | 0x02, 0x03, 0x04, 0x05 |
| 13511 | }; |
| 13512 | |
| 13513 | /* dac_nids for ALC660vd are in a different order - according to |
| 13514 | * Realtek's driver. |
| 13515 | * This should probably tesult in a different mixer for 6stack models |
| 13516 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 13517 | * - and it is the same as in 861vd. |
| 13518 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 13519 | */ |
| 13520 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 13521 | /* front, rear, clfe, rear_surr */ |
| 13522 | 0x02, 0x04, 0x03 |
| 13523 | }; |
| 13524 | |
| 13525 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 13526 | /* ADC0 */ |
| 13527 | 0x09, |
| 13528 | }; |
| 13529 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13530 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 13531 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13532 | /* input MUX */ |
| 13533 | /* FIXME: should be a matrix-type input source selection */ |
| 13534 | static struct hda_input_mux alc861vd_capture_source = { |
| 13535 | .num_items = 4, |
| 13536 | .items = { |
| 13537 | { "Mic", 0x0 }, |
| 13538 | { "Front Mic", 0x1 }, |
| 13539 | { "Line", 0x2 }, |
| 13540 | { "CD", 0x4 }, |
| 13541 | }, |
| 13542 | }; |
| 13543 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13544 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13545 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13546 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13547 | { "Ext Mic", 0x0 }, |
| 13548 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13549 | }, |
| 13550 | }; |
| 13551 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13552 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 13553 | .num_items = 2, |
| 13554 | .items = { |
| 13555 | { "Front Mic", 0x0 }, |
| 13556 | { "ATAPI Mic", 0x1 }, |
| 13557 | }, |
| 13558 | }; |
| 13559 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13560 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 13561 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13562 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 13563 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13564 | |
| 13565 | /* |
| 13566 | * 2ch mode |
| 13567 | */ |
| 13568 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 13569 | { 2, NULL } |
| 13570 | }; |
| 13571 | |
| 13572 | /* |
| 13573 | * 6ch mode |
| 13574 | */ |
| 13575 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 13576 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13577 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13578 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13579 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13580 | { } /* end */ |
| 13581 | }; |
| 13582 | |
| 13583 | /* |
| 13584 | * 8ch mode |
| 13585 | */ |
| 13586 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 13587 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13588 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13589 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13590 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13591 | { } /* end */ |
| 13592 | }; |
| 13593 | |
| 13594 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 13595 | { 6, alc861vd_6stack_ch6_init }, |
| 13596 | { 8, alc861vd_6stack_ch8_init }, |
| 13597 | }; |
| 13598 | |
| 13599 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 13600 | { |
| 13601 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13602 | .name = "Channel Mode", |
| 13603 | .info = alc_ch_mode_info, |
| 13604 | .get = alc_ch_mode_get, |
| 13605 | .put = alc_ch_mode_put, |
| 13606 | }, |
| 13607 | { } /* end */ |
| 13608 | }; |
| 13609 | |
| 13610 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 13611 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13612 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13613 | |
| 13614 | { |
| 13615 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13616 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13617 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13618 | */ |
| 13619 | /* .name = "Capture Source", */ |
| 13620 | .name = "Input Source", |
| 13621 | .count = 1, |
| 13622 | .info = alc861vd_mux_enum_info, |
| 13623 | .get = alc861vd_mux_enum_get, |
| 13624 | .put = alc861vd_mux_enum_put, |
| 13625 | }, |
| 13626 | { } /* end */ |
| 13627 | }; |
| 13628 | |
| 13629 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13630 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13631 | */ |
| 13632 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 13633 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13634 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13635 | |
| 13636 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13637 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13638 | |
| 13639 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 13640 | HDA_OUTPUT), |
| 13641 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 13642 | HDA_OUTPUT), |
| 13643 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13644 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 13645 | |
| 13646 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 13647 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13648 | |
| 13649 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13650 | |
| 13651 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13652 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13653 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13654 | |
| 13655 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13656 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13657 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13658 | |
| 13659 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13660 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13661 | |
| 13662 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13663 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13664 | |
| 13665 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13666 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13667 | |
| 13668 | { } /* end */ |
| 13669 | }; |
| 13670 | |
| 13671 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 13672 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13673 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13674 | |
| 13675 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13676 | |
| 13677 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13678 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13679 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13680 | |
| 13681 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13682 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13683 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13684 | |
| 13685 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13686 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13687 | |
| 13688 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13689 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13690 | |
| 13691 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13692 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13693 | |
| 13694 | { } /* end */ |
| 13695 | }; |
| 13696 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13697 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 13698 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13699 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 13700 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13701 | |
| 13702 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13703 | |
| 13704 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13705 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13706 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13707 | |
| 13708 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13709 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13710 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13711 | |
| 13712 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13713 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13714 | |
| 13715 | { } /* end */ |
| 13716 | }; |
| 13717 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13718 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 13719 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13720 | */ |
| 13721 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13722 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13723 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13724 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13725 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13726 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13727 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13728 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13729 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13730 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13731 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13732 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 13733 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13734 | { } /* end */ |
| 13735 | }; |
| 13736 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13737 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 13738 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 13739 | */ |
| 13740 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 13741 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13742 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13743 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13744 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13745 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13746 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13747 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13748 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13749 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13750 | { } /* end */ |
| 13751 | }; |
| 13752 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13753 | /* |
| 13754 | * generic initialization of ADC, input mixers and output mixers |
| 13755 | */ |
| 13756 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 13757 | /* |
| 13758 | * Unmute ADC0 and set the default input to mic-in |
| 13759 | */ |
| 13760 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13761 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13762 | |
| 13763 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 13764 | * the analog-loopback mixer widget |
| 13765 | */ |
| 13766 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13768 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13769 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13770 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13771 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13772 | |
| 13773 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13774 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13775 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13776 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13777 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13778 | |
| 13779 | /* |
| 13780 | * Set up output mixers (0x02 - 0x05) |
| 13781 | */ |
| 13782 | /* set vol=0 to output mixers */ |
| 13783 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13784 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13785 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13786 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13787 | |
| 13788 | /* set up input amps for analog loopback */ |
| 13789 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13790 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13791 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13792 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13793 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13794 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13795 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13796 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13797 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13798 | |
| 13799 | { } |
| 13800 | }; |
| 13801 | |
| 13802 | /* |
| 13803 | * 3-stack pin configuration: |
| 13804 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 13805 | */ |
| 13806 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 13807 | /* |
| 13808 | * Set pin mode and muting |
| 13809 | */ |
| 13810 | /* set front pin widgets 0x14 for output */ |
| 13811 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13812 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13813 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13814 | |
| 13815 | /* Mic (rear) pin: input vref at 80% */ |
| 13816 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13817 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13818 | /* Front Mic pin: input vref at 80% */ |
| 13819 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13820 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13821 | /* Line In pin: input */ |
| 13822 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13823 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13824 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13825 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13826 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13827 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13828 | /* CD pin widget for input */ |
| 13829 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13830 | |
| 13831 | { } |
| 13832 | }; |
| 13833 | |
| 13834 | /* |
| 13835 | * 6-stack pin configuration: |
| 13836 | */ |
| 13837 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 13838 | /* |
| 13839 | * Set pin mode and muting |
| 13840 | */ |
| 13841 | /* set front pin widgets 0x14 for output */ |
| 13842 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13843 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13844 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13845 | |
| 13846 | /* Rear Pin: output 1 (0x0d) */ |
| 13847 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13848 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13849 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13850 | /* CLFE Pin: output 2 (0x0e) */ |
| 13851 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13852 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13853 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 13854 | /* Side Pin: output 3 (0x0f) */ |
| 13855 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13856 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13857 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 13858 | |
| 13859 | /* Mic (rear) pin: input vref at 80% */ |
| 13860 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13861 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13862 | /* Front Mic pin: input vref at 80% */ |
| 13863 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13864 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13865 | /* Line In pin: input */ |
| 13866 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13867 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13868 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13869 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13870 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13871 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13872 | /* CD pin widget for input */ |
| 13873 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13874 | |
| 13875 | { } |
| 13876 | }; |
| 13877 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13878 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 13879 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13880 | { } |
| 13881 | }; |
| 13882 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 13883 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 13884 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13885 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13886 | { } |
| 13887 | }; |
| 13888 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13889 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 13890 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13891 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13892 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 13893 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13894 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13895 | {} |
| 13896 | }; |
| 13897 | |
| 13898 | /* toggle speaker-output according to the hp-jack state */ |
| 13899 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 13900 | { |
| 13901 | unsigned int present; |
| 13902 | unsigned char bits; |
| 13903 | |
| 13904 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13905 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13906 | bits = present ? HDA_AMP_MUTE : 0; |
| 13907 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13908 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13909 | } |
| 13910 | |
| 13911 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 13912 | { |
| 13913 | unsigned int present; |
| 13914 | unsigned char bits; |
| 13915 | |
| 13916 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13917 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13918 | bits = present ? HDA_AMP_MUTE : 0; |
| 13919 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 13920 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13921 | } |
| 13922 | |
| 13923 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 13924 | { |
| 13925 | alc861vd_lenovo_hp_automute(codec); |
| 13926 | alc861vd_lenovo_mic_automute(codec); |
| 13927 | } |
| 13928 | |
| 13929 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 13930 | unsigned int res) |
| 13931 | { |
| 13932 | switch (res >> 26) { |
| 13933 | case ALC880_HP_EVENT: |
| 13934 | alc861vd_lenovo_hp_automute(codec); |
| 13935 | break; |
| 13936 | case ALC880_MIC_EVENT: |
| 13937 | alc861vd_lenovo_mic_automute(codec); |
| 13938 | break; |
| 13939 | } |
| 13940 | } |
| 13941 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13942 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 13943 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13944 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13945 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13946 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13947 | |
| 13948 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13949 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13950 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13951 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13952 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13953 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13954 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13955 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13956 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13957 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13958 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13959 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13960 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13961 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13962 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13963 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13964 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13965 | |
| 13966 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13967 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13968 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13969 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13970 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13971 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13972 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13973 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13974 | |
| 13975 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13976 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13977 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13978 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13979 | |
| 13980 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13981 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13982 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13983 | |
| 13984 | { } /* end */ |
| 13985 | }; |
| 13986 | |
| 13987 | /* toggle speaker-output according to the hp-jack state */ |
| 13988 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 13989 | { |
| 13990 | unsigned int present; |
| 13991 | |
| 13992 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13993 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13994 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13995 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13996 | } |
| 13997 | |
| 13998 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 13999 | { |
| 14000 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14001 | alc861vd_dallas_automute(codec); |
| 14002 | } |
| 14003 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14004 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14005 | #define alc861vd_loopbacks alc880_loopbacks |
| 14006 | #endif |
| 14007 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14008 | /* pcm configuration: identiacal with ALC880 */ |
| 14009 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14010 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14011 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14012 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14013 | |
| 14014 | /* |
| 14015 | * configuration and preset |
| 14016 | */ |
| 14017 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14018 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14019 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14020 | [ALC861VD_3ST] = "3stack", |
| 14021 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14022 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14023 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14024 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14025 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14026 | [ALC861VD_AUTO] = "auto", |
| 14027 | }; |
| 14028 | |
| 14029 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14030 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14031 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14032 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14033 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Alexander Holler | 2522d73 | 2008-07-17 23:36:15 +0200 | [diff] [blame] | 14034 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14035 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14036 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14037 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14038 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14039 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14040 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14041 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14042 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14043 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 14044 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Takashi Iwai | be321a89 | 2008-07-07 16:04:04 +0200 | [diff] [blame] | 14045 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14046 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14047 | {} |
| 14048 | }; |
| 14049 | |
| 14050 | static struct alc_config_preset alc861vd_presets[] = { |
| 14051 | [ALC660VD_3ST] = { |
| 14052 | .mixers = { alc861vd_3st_mixer }, |
| 14053 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14054 | alc861vd_3stack_init_verbs }, |
| 14055 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14056 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14057 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14058 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14059 | .input_mux = &alc861vd_capture_source, |
| 14060 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14061 | [ALC660VD_3ST_DIG] = { |
| 14062 | .mixers = { alc861vd_3st_mixer }, |
| 14063 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14064 | alc861vd_3stack_init_verbs }, |
| 14065 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14066 | .dac_nids = alc660vd_dac_nids, |
| 14067 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14068 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14069 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14070 | .input_mux = &alc861vd_capture_source, |
| 14071 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14072 | [ALC861VD_3ST] = { |
| 14073 | .mixers = { alc861vd_3st_mixer }, |
| 14074 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14075 | alc861vd_3stack_init_verbs }, |
| 14076 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14077 | .dac_nids = alc861vd_dac_nids, |
| 14078 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14079 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14080 | .input_mux = &alc861vd_capture_source, |
| 14081 | }, |
| 14082 | [ALC861VD_3ST_DIG] = { |
| 14083 | .mixers = { alc861vd_3st_mixer }, |
| 14084 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14085 | alc861vd_3stack_init_verbs }, |
| 14086 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14087 | .dac_nids = alc861vd_dac_nids, |
| 14088 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14089 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14090 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14091 | .input_mux = &alc861vd_capture_source, |
| 14092 | }, |
| 14093 | [ALC861VD_6ST_DIG] = { |
| 14094 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14095 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14096 | alc861vd_6stack_init_verbs }, |
| 14097 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14098 | .dac_nids = alc861vd_dac_nids, |
| 14099 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14100 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14101 | .channel_mode = alc861vd_6stack_modes, |
| 14102 | .input_mux = &alc861vd_capture_source, |
| 14103 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14104 | [ALC861VD_LENOVO] = { |
| 14105 | .mixers = { alc861vd_lenovo_mixer }, |
| 14106 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14107 | alc861vd_3stack_init_verbs, |
| 14108 | alc861vd_eapd_verbs, |
| 14109 | alc861vd_lenovo_unsol_verbs }, |
| 14110 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14111 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14112 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14113 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14114 | .input_mux = &alc861vd_capture_source, |
| 14115 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14116 | .init_hook = alc861vd_lenovo_automute, |
| 14117 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14118 | [ALC861VD_DALLAS] = { |
| 14119 | .mixers = { alc861vd_dallas_mixer }, |
| 14120 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14121 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14122 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14123 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14124 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14125 | .input_mux = &alc861vd_dallas_capture_source, |
| 14126 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14127 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14128 | }, |
| 14129 | [ALC861VD_HP] = { |
| 14130 | .mixers = { alc861vd_hp_mixer }, |
| 14131 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14132 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14133 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14134 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14135 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14136 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14137 | .input_mux = &alc861vd_hp_capture_source, |
| 14138 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14139 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14140 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14141 | }; |
| 14142 | |
| 14143 | /* |
| 14144 | * BIOS auto configuration |
| 14145 | */ |
| 14146 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14147 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14148 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14149 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14150 | } |
| 14151 | |
| 14152 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14153 | { |
| 14154 | struct alc_spec *spec = codec->spec; |
| 14155 | int i; |
| 14156 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14157 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14158 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14159 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14160 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14161 | if (nid) |
| 14162 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14163 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14164 | } |
| 14165 | } |
| 14166 | |
| 14167 | |
| 14168 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14169 | { |
| 14170 | struct alc_spec *spec = codec->spec; |
| 14171 | hda_nid_t pin; |
| 14172 | |
| 14173 | pin = spec->autocfg.hp_pins[0]; |
| 14174 | if (pin) /* connect to front and use dac 0 */ |
| 14175 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14176 | pin = spec->autocfg.speaker_pins[0]; |
| 14177 | if (pin) |
| 14178 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14179 | } |
| 14180 | |
| 14181 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14182 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14183 | |
| 14184 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14185 | { |
| 14186 | struct alc_spec *spec = codec->spec; |
| 14187 | int i; |
| 14188 | |
| 14189 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14190 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14191 | if (alc861vd_is_input_pin(nid)) { |
| 14192 | snd_hda_codec_write(codec, nid, 0, |
| 14193 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14194 | i <= AUTO_PIN_FRONT_MIC ? |
| 14195 | PIN_VREF80 : PIN_IN); |
| 14196 | if (nid != ALC861VD_PIN_CD_NID) |
| 14197 | snd_hda_codec_write(codec, nid, 0, |
| 14198 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14199 | AMP_OUT_MUTE); |
| 14200 | } |
| 14201 | } |
| 14202 | } |
| 14203 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14204 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14205 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14206 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14207 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14208 | |
| 14209 | /* add playback controls from the parsed DAC table */ |
| 14210 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14211 | * different NIDs for mute/unmute switch and volume control */ |
| 14212 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14213 | const struct auto_pin_cfg *cfg) |
| 14214 | { |
| 14215 | char name[32]; |
| 14216 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14217 | hda_nid_t nid_v, nid_s; |
| 14218 | int i, err; |
| 14219 | |
| 14220 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14221 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14222 | continue; |
| 14223 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14224 | alc880_dac_to_idx( |
| 14225 | spec->multiout.dac_nids[i])); |
| 14226 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14227 | alc880_dac_to_idx( |
| 14228 | spec->multiout.dac_nids[i])); |
| 14229 | |
| 14230 | if (i == 2) { |
| 14231 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14232 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14233 | "Center Playback Volume", |
| 14234 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14235 | HDA_OUTPUT)); |
| 14236 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14237 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14238 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14239 | "LFE Playback Volume", |
| 14240 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14241 | HDA_OUTPUT)); |
| 14242 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14243 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14244 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14245 | "Center Playback Switch", |
| 14246 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14247 | HDA_INPUT)); |
| 14248 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14249 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14250 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14251 | "LFE Playback Switch", |
| 14252 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14253 | HDA_INPUT)); |
| 14254 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14255 | return err; |
| 14256 | } else { |
| 14257 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14258 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14259 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14260 | HDA_OUTPUT)); |
| 14261 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14262 | return err; |
| 14263 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14264 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14265 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14266 | HDA_INPUT)); |
| 14267 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14268 | return err; |
| 14269 | } |
| 14270 | } |
| 14271 | return 0; |
| 14272 | } |
| 14273 | |
| 14274 | /* add playback controls for speaker and HP outputs */ |
| 14275 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14276 | * different NIDs for mute/unmute switch and volume control */ |
| 14277 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14278 | hda_nid_t pin, const char *pfx) |
| 14279 | { |
| 14280 | hda_nid_t nid_v, nid_s; |
| 14281 | int err; |
| 14282 | char name[32]; |
| 14283 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14284 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14285 | return 0; |
| 14286 | |
| 14287 | if (alc880_is_fixed_pin(pin)) { |
| 14288 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14289 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14290 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14291 | spec->multiout.hp_nid = nid_v; |
| 14292 | else |
| 14293 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14294 | /* control HP volume/switch on the output mixer amp */ |
| 14295 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14296 | alc880_fixed_pin_idx(pin)); |
| 14297 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14298 | alc880_fixed_pin_idx(pin)); |
| 14299 | |
| 14300 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14301 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14302 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14303 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14304 | return err; |
| 14305 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14306 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14307 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14308 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14309 | return err; |
| 14310 | } else if (alc880_is_multi_pin(pin)) { |
| 14311 | /* set manual connection */ |
| 14312 | /* we have only a switch on HP-out PIN */ |
| 14313 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14314 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14315 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14316 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14317 | return err; |
| 14318 | } |
| 14319 | return 0; |
| 14320 | } |
| 14321 | |
| 14322 | /* parse the BIOS configuration and set up the alc_spec |
| 14323 | * return 1 if successful, 0 if the proper config is not found, |
| 14324 | * or a negative error code |
| 14325 | * Based on ALC880 version - had to change it to override |
| 14326 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 14327 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 14328 | { |
| 14329 | struct alc_spec *spec = codec->spec; |
| 14330 | int err; |
| 14331 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 14332 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14333 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14334 | alc861vd_ignore); |
| 14335 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14336 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14337 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14338 | return 0; /* can't find valid BIOS pin config */ |
| 14339 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14340 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14341 | if (err < 0) |
| 14342 | return err; |
| 14343 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14344 | if (err < 0) |
| 14345 | return err; |
| 14346 | err = alc861vd_auto_create_extra_out(spec, |
| 14347 | spec->autocfg.speaker_pins[0], |
| 14348 | "Speaker"); |
| 14349 | if (err < 0) |
| 14350 | return err; |
| 14351 | err = alc861vd_auto_create_extra_out(spec, |
| 14352 | spec->autocfg.hp_pins[0], |
| 14353 | "Headphone"); |
| 14354 | if (err < 0) |
| 14355 | return err; |
| 14356 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14357 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14358 | return err; |
| 14359 | |
| 14360 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14361 | |
| 14362 | if (spec->autocfg.dig_out_pin) |
| 14363 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 14364 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 14365 | if (spec->kctls.list) |
| 14366 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14367 | |
| 14368 | spec->init_verbs[spec->num_init_verbs++] |
| 14369 | = alc861vd_volume_init_verbs; |
| 14370 | |
| 14371 | spec->num_mux_defs = 1; |
| 14372 | spec->input_mux = &spec->private_imux; |
| 14373 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 14374 | err = alc_auto_add_mic_boost(codec); |
| 14375 | if (err < 0) |
| 14376 | return err; |
| 14377 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14378 | return 1; |
| 14379 | } |
| 14380 | |
| 14381 | /* additional initialization for auto-configuration model */ |
| 14382 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 14383 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14384 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14385 | alc861vd_auto_init_multi_out(codec); |
| 14386 | alc861vd_auto_init_hp_out(codec); |
| 14387 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14388 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14389 | if (spec->unsol_event) |
| 14390 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14391 | } |
| 14392 | |
| 14393 | static int patch_alc861vd(struct hda_codec *codec) |
| 14394 | { |
| 14395 | struct alc_spec *spec; |
| 14396 | int err, board_config; |
| 14397 | |
| 14398 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14399 | if (spec == NULL) |
| 14400 | return -ENOMEM; |
| 14401 | |
| 14402 | codec->spec = spec; |
| 14403 | |
| 14404 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 14405 | alc861vd_models, |
| 14406 | alc861vd_cfg_tbl); |
| 14407 | |
| 14408 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 14409 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 14410 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 14411 | board_config = ALC861VD_AUTO; |
| 14412 | } |
| 14413 | |
| 14414 | if (board_config == ALC861VD_AUTO) { |
| 14415 | /* automatic parse from the BIOS config */ |
| 14416 | err = alc861vd_parse_auto_config(codec); |
| 14417 | if (err < 0) { |
| 14418 | alc_free(codec); |
| 14419 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14420 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14421 | printk(KERN_INFO |
| 14422 | "hda_codec: Cannot set up configuration " |
| 14423 | "from BIOS. Using base mode...\n"); |
| 14424 | board_config = ALC861VD_3ST; |
| 14425 | } |
| 14426 | } |
| 14427 | |
| 14428 | if (board_config != ALC861VD_AUTO) |
| 14429 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 14430 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14431 | if (codec->vendor_id == 0x10ec0660) { |
| 14432 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 14433 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14434 | /* always turn on EAPD */ |
| 14435 | spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14436 | } else { |
| 14437 | spec->stream_name_analog = "ALC861VD Analog"; |
| 14438 | spec->stream_name_digital = "ALC861VD Digital"; |
| 14439 | } |
| 14440 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14441 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 14442 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 14443 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14444 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 14445 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 14446 | |
| 14447 | spec->adc_nids = alc861vd_adc_nids; |
| 14448 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14449 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14450 | |
| 14451 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 14452 | spec->num_mixers++; |
| 14453 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14454 | spec->vmaster_nid = 0x02; |
| 14455 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14456 | codec->patch_ops = alc_patch_ops; |
| 14457 | |
| 14458 | if (board_config == ALC861VD_AUTO) |
| 14459 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14460 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14461 | if (!spec->loopback.amplist) |
| 14462 | spec->loopback.amplist = alc861vd_loopbacks; |
| 14463 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14464 | |
| 14465 | return 0; |
| 14466 | } |
| 14467 | |
| 14468 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14469 | * ALC662 support |
| 14470 | * |
| 14471 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 14472 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 14473 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 14474 | * 6-channel independent captures. |
| 14475 | * |
| 14476 | * In addition, an independent DAC for the multi-playback (not used in this |
| 14477 | * driver yet). |
| 14478 | */ |
| 14479 | #define ALC662_DIGOUT_NID 0x06 |
| 14480 | #define ALC662_DIGIN_NID 0x0a |
| 14481 | |
| 14482 | static hda_nid_t alc662_dac_nids[4] = { |
| 14483 | /* front, rear, clfe, rear_surr */ |
| 14484 | 0x02, 0x03, 0x04 |
| 14485 | }; |
| 14486 | |
| 14487 | static hda_nid_t alc662_adc_nids[1] = { |
| 14488 | /* ADC1-2 */ |
| 14489 | 0x09, |
| 14490 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14491 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 14492 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14493 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14494 | /* input MUX */ |
| 14495 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14496 | static struct hda_input_mux alc662_capture_source = { |
| 14497 | .num_items = 4, |
| 14498 | .items = { |
| 14499 | { "Mic", 0x0 }, |
| 14500 | { "Front Mic", 0x1 }, |
| 14501 | { "Line", 0x2 }, |
| 14502 | { "CD", 0x4 }, |
| 14503 | }, |
| 14504 | }; |
| 14505 | |
| 14506 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 14507 | .num_items = 2, |
| 14508 | .items = { |
| 14509 | { "Mic", 0x1 }, |
| 14510 | { "Line", 0x2 }, |
| 14511 | }, |
| 14512 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14513 | |
| 14514 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 14515 | .num_items = 2, |
| 14516 | .items = { |
| 14517 | { "i-Mic", 0x1 }, |
| 14518 | { "e-Mic", 0x0 }, |
| 14519 | }, |
| 14520 | }; |
| 14521 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14522 | static struct hda_input_mux alc663_capture_source = { |
| 14523 | .num_items = 3, |
| 14524 | .items = { |
| 14525 | { "Mic", 0x0 }, |
| 14526 | { "Front Mic", 0x1 }, |
| 14527 | { "Line", 0x2 }, |
| 14528 | }, |
| 14529 | }; |
| 14530 | |
| 14531 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 14532 | .num_items = 2, |
| 14533 | .items = { |
| 14534 | { "Ext-Mic", 0x0 }, |
| 14535 | { "D-Mic", 0x9 }, |
| 14536 | }, |
| 14537 | }; |
| 14538 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14539 | #define alc662_mux_enum_info alc_mux_enum_info |
| 14540 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14541 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14542 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14543 | /* |
| 14544 | * 2ch mode |
| 14545 | */ |
| 14546 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 14547 | { 2, NULL } |
| 14548 | }; |
| 14549 | |
| 14550 | /* |
| 14551 | * 2ch mode |
| 14552 | */ |
| 14553 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 14554 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 14555 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14556 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 14557 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14558 | { } /* end */ |
| 14559 | }; |
| 14560 | |
| 14561 | /* |
| 14562 | * 6ch mode |
| 14563 | */ |
| 14564 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 14565 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14566 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14567 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 14568 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14569 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14570 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14571 | { } /* end */ |
| 14572 | }; |
| 14573 | |
| 14574 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 14575 | { 2, alc662_3ST_ch2_init }, |
| 14576 | { 6, alc662_3ST_ch6_init }, |
| 14577 | }; |
| 14578 | |
| 14579 | /* |
| 14580 | * 2ch mode |
| 14581 | */ |
| 14582 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 14583 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14584 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14585 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14586 | { } /* end */ |
| 14587 | }; |
| 14588 | |
| 14589 | /* |
| 14590 | * 6ch mode |
| 14591 | */ |
| 14592 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 14593 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14594 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14595 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14596 | { } /* end */ |
| 14597 | }; |
| 14598 | |
| 14599 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 14600 | { 2, alc662_sixstack_ch6_init }, |
| 14601 | { 6, alc662_sixstack_ch8_init }, |
| 14602 | }; |
| 14603 | |
| 14604 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14605 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14606 | */ |
| 14607 | |
| 14608 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 14609 | /* output mixer control */ |
| 14610 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14611 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14612 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14613 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14614 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14615 | 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] | 14616 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14617 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14618 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14619 | |
| 14620 | /*Input mixer control */ |
| 14621 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 14622 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 14623 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 14624 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 14625 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 14626 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 14627 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 14628 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14629 | { } /* end */ |
| 14630 | }; |
| 14631 | |
| 14632 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 14633 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14634 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14635 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14636 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14637 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14638 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14639 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14640 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14641 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14642 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14643 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14644 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14645 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14646 | { } /* end */ |
| 14647 | }; |
| 14648 | |
| 14649 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 14650 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14651 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14652 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14653 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14654 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14655 | 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] | 14656 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14657 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14658 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14659 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14660 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14661 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14662 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14663 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14664 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14665 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14666 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14667 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14668 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14669 | { } /* end */ |
| 14670 | }; |
| 14671 | |
| 14672 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 14673 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14674 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14675 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14676 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14677 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14678 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14679 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14680 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14681 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14682 | { } /* end */ |
| 14683 | }; |
| 14684 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14685 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14686 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14687 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 14688 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14689 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14690 | |
| 14691 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 14692 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14693 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14694 | |
| 14695 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 14696 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14697 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14698 | { } /* end */ |
| 14699 | }; |
| 14700 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14701 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 14702 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14703 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14704 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14705 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 14706 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14707 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 14708 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 14709 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14710 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14711 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14712 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14713 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14714 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14715 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14716 | { } /* end */ |
| 14717 | }; |
| 14718 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14719 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 14720 | .ops = &snd_hda_bind_vol, |
| 14721 | .values = { |
| 14722 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 14723 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 14724 | 0 |
| 14725 | }, |
| 14726 | }; |
| 14727 | |
| 14728 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 14729 | .ops = &snd_hda_bind_sw, |
| 14730 | .values = { |
| 14731 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14732 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 14733 | 0 |
| 14734 | }, |
| 14735 | }; |
| 14736 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14737 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14738 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14739 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 14740 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14741 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14742 | { } /* end */ |
| 14743 | }; |
| 14744 | |
| 14745 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 14746 | .ops = &snd_hda_bind_sw, |
| 14747 | .values = { |
| 14748 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14749 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 14750 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 14751 | 0 |
| 14752 | }, |
| 14753 | }; |
| 14754 | |
| 14755 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 14756 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14757 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 14758 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14759 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14760 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14761 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14762 | |
| 14763 | { } /* end */ |
| 14764 | }; |
| 14765 | |
| 14766 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 14767 | .ops = &snd_hda_bind_sw, |
| 14768 | .values = { |
| 14769 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14770 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 14771 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 14772 | 0 |
| 14773 | }, |
| 14774 | }; |
| 14775 | |
| 14776 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 14777 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14778 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 14779 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14780 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14781 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14782 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14783 | { } /* end */ |
| 14784 | }; |
| 14785 | |
| 14786 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14787 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14788 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14789 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14790 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14791 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14792 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14793 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14794 | { } /* end */ |
| 14795 | }; |
| 14796 | |
| 14797 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 14798 | .ops = &snd_hda_bind_vol, |
| 14799 | .values = { |
| 14800 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 14801 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 14802 | 0 |
| 14803 | }, |
| 14804 | }; |
| 14805 | |
| 14806 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 14807 | .ops = &snd_hda_bind_sw, |
| 14808 | .values = { |
| 14809 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14810 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 14811 | 0 |
| 14812 | }, |
| 14813 | }; |
| 14814 | |
| 14815 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 14816 | HDA_BIND_VOL("Master Playback Volume", |
| 14817 | &alc663_asus_two_bind_master_vol), |
| 14818 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 14819 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14820 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14821 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14822 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14823 | { } /* end */ |
| 14824 | }; |
| 14825 | |
| 14826 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 14827 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14828 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 14829 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14830 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14831 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14832 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14833 | { } /* end */ |
| 14834 | }; |
| 14835 | |
| 14836 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 14837 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14838 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14839 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14840 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14841 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14842 | |
| 14843 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14844 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14845 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14846 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14847 | { } /* end */ |
| 14848 | }; |
| 14849 | |
| 14850 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 14851 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14852 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14853 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14854 | |
| 14855 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14856 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14857 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14858 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14859 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14860 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14861 | { } /* end */ |
| 14862 | }; |
| 14863 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14864 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 14865 | { |
| 14866 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14867 | .name = "Channel Mode", |
| 14868 | .info = alc_ch_mode_info, |
| 14869 | .get = alc_ch_mode_get, |
| 14870 | .put = alc_ch_mode_put, |
| 14871 | }, |
| 14872 | { } /* end */ |
| 14873 | }; |
| 14874 | |
| 14875 | static struct hda_verb alc662_init_verbs[] = { |
| 14876 | /* ADC: mute amp left and right */ |
| 14877 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14878 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14879 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 14880 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14881 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14882 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14883 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14884 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14885 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14886 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14887 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14889 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14890 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14891 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14892 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14893 | |
| 14894 | /* Front Pin: output 0 (0x0c) */ |
| 14895 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14896 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14897 | |
| 14898 | /* Rear Pin: output 1 (0x0d) */ |
| 14899 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14900 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14901 | |
| 14902 | /* CLFE Pin: output 2 (0x0e) */ |
| 14903 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14904 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14905 | |
| 14906 | /* Mic (rear) pin: input vref at 80% */ |
| 14907 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14908 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14909 | /* Front Mic pin: input vref at 80% */ |
| 14910 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14911 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14912 | /* Line In pin: input */ |
| 14913 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14914 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14915 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14916 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14917 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14918 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14919 | /* CD pin widget for input */ |
| 14920 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14921 | |
| 14922 | /* FIXME: use matrix-type input source selection */ |
| 14923 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 14924 | /* Input mixer */ |
| 14925 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14926 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14927 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14928 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14929 | |
| 14930 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14931 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14932 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14933 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14934 | |
| 14935 | /* always trun on EAPD */ |
| 14936 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14937 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14938 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14939 | { } |
| 14940 | }; |
| 14941 | |
| 14942 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 14943 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 14944 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14945 | {} |
| 14946 | }; |
| 14947 | |
| 14948 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 14949 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14950 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14951 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14952 | }; |
| 14953 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14954 | /* Set Unsolicited Event*/ |
| 14955 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 14956 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14957 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14958 | {} |
| 14959 | }; |
| 14960 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14961 | /* |
| 14962 | * generic initialization of ADC, input mixers and output mixers |
| 14963 | */ |
| 14964 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 14965 | /* |
| 14966 | * Unmute ADC and set the default input to mic-in |
| 14967 | */ |
| 14968 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14969 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14970 | |
| 14971 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 14972 | * mixer widget |
| 14973 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 14974 | * panel mic (mic 2) |
| 14975 | */ |
| 14976 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14977 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14978 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14979 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14980 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14981 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14982 | |
| 14983 | /* |
| 14984 | * Set up output mixers (0x0c - 0x0f) |
| 14985 | */ |
| 14986 | /* set vol=0 to output mixers */ |
| 14987 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14988 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14989 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14990 | |
| 14991 | /* set up input amps for analog loopback */ |
| 14992 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14993 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14994 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14995 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14996 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14997 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14998 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14999 | |
| 15000 | |
| 15001 | /* FIXME: use matrix-type input source selection */ |
| 15002 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15003 | /* Input mixer */ |
| 15004 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15005 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15006 | { } |
| 15007 | }; |
| 15008 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15009 | /* additional verbs for ALC663 */ |
| 15010 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15011 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15012 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15013 | { } |
| 15014 | }; |
| 15015 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15016 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15017 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15018 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15019 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15020 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15021 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15022 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15023 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15024 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15025 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15026 | {} |
| 15027 | }; |
| 15028 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15029 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15030 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15031 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15032 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15033 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15034 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15035 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15036 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15037 | {} |
| 15038 | }; |
| 15039 | |
| 15040 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15041 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15042 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15043 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15044 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15045 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15046 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15047 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15048 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15049 | {} |
| 15050 | }; |
| 15051 | |
| 15052 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15053 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15054 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15055 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15056 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15058 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15059 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15060 | {} |
| 15061 | }; |
| 15062 | |
| 15063 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15064 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15065 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15066 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15067 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15068 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15069 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15070 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15071 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15072 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15073 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15074 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15075 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15076 | {} |
| 15077 | }; |
| 15078 | |
| 15079 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15080 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15081 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15082 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15083 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15084 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15085 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15086 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15088 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15089 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15090 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15091 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15092 | {} |
| 15093 | }; |
| 15094 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15095 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15096 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15097 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15098 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15099 | |
| 15100 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15101 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15102 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15103 | |
| 15104 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15105 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15106 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15107 | {} |
| 15108 | }; |
| 15109 | |
| 15110 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15111 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15112 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15113 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15114 | |
| 15115 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15116 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15117 | {} |
| 15118 | }; |
| 15119 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15120 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15121 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15122 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15123 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15124 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15125 | {} |
| 15126 | }; |
| 15127 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15128 | /* capture mixer elements */ |
| 15129 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 15130 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15131 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15132 | { |
| 15133 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15134 | /* The multiple "Capture Source" controls confuse alsamixer |
| 15135 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15136 | */ |
| 15137 | /* .name = "Capture Source", */ |
| 15138 | .name = "Input Source", |
| 15139 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 15140 | .info = alc662_mux_enum_info, |
| 15141 | .get = alc662_mux_enum_get, |
| 15142 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15143 | }, |
| 15144 | { } /* end */ |
| 15145 | }; |
| 15146 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15147 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15148 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15149 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15150 | { } /* end */ |
| 15151 | }; |
| 15152 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15153 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15154 | { |
| 15155 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15156 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15157 | |
| 15158 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15159 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15160 | bits = present ? HDA_AMP_MUTE : 0; |
| 15161 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15162 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15163 | } |
| 15164 | |
| 15165 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15166 | { |
| 15167 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15168 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15169 | |
| 15170 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15171 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15172 | bits = present ? HDA_AMP_MUTE : 0; |
| 15173 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15174 | HDA_AMP_MUTE, bits); |
| 15175 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15176 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15177 | } |
| 15178 | |
| 15179 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15180 | unsigned int res) |
| 15181 | { |
| 15182 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15183 | alc662_lenovo_101e_all_automute(codec); |
| 15184 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15185 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15186 | } |
| 15187 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15188 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15189 | { |
| 15190 | unsigned int present; |
| 15191 | |
| 15192 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15193 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15194 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15195 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15196 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15197 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15198 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15199 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15200 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15201 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15202 | } |
| 15203 | |
| 15204 | /* unsolicited event for HP jack sensing */ |
| 15205 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15206 | unsigned int res) |
| 15207 | { |
| 15208 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15209 | alc262_hippo1_automute( codec ); |
| 15210 | |
| 15211 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15212 | alc662_eeepc_mic_automute(codec); |
| 15213 | } |
| 15214 | |
| 15215 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15216 | { |
| 15217 | alc262_hippo1_automute( codec ); |
| 15218 | alc662_eeepc_mic_automute(codec); |
| 15219 | } |
| 15220 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15221 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 15222 | { |
| 15223 | unsigned int mute; |
| 15224 | unsigned int present; |
| 15225 | |
| 15226 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 15227 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15228 | AC_VERB_GET_PIN_SENSE, 0); |
| 15229 | present = (present & 0x80000000) != 0; |
| 15230 | if (present) { |
| 15231 | /* mute internal speaker */ |
| 15232 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15233 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15234 | } else { |
| 15235 | /* unmute internal speaker if necessary */ |
| 15236 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 15237 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15238 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15239 | } |
| 15240 | } |
| 15241 | |
| 15242 | /* unsolicited event for HP jack sensing */ |
| 15243 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 15244 | unsigned int res) |
| 15245 | { |
| 15246 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15247 | alc662_eeepc_ep20_automute(codec); |
| 15248 | } |
| 15249 | |
| 15250 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15251 | { |
| 15252 | alc662_eeepc_ep20_automute(codec); |
| 15253 | } |
| 15254 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15255 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15256 | { |
| 15257 | unsigned int present; |
| 15258 | unsigned char bits; |
| 15259 | |
| 15260 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15261 | AC_VERB_GET_PIN_SENSE, 0) |
| 15262 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15263 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15264 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15265 | AMP_IN_MUTE(0), bits); |
| 15266 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15267 | AMP_IN_MUTE(0), bits); |
| 15268 | } |
| 15269 | |
| 15270 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15271 | { |
| 15272 | unsigned int present; |
| 15273 | unsigned char bits; |
| 15274 | |
| 15275 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15276 | AC_VERB_GET_PIN_SENSE, 0) |
| 15277 | & AC_PINSENSE_PRESENCE; |
| 15278 | bits = present ? HDA_AMP_MUTE : 0; |
| 15279 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15280 | AMP_IN_MUTE(0), bits); |
| 15281 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15282 | AMP_IN_MUTE(0), bits); |
| 15283 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15284 | AMP_IN_MUTE(0), bits); |
| 15285 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15286 | AMP_IN_MUTE(0), bits); |
| 15287 | } |
| 15288 | |
| 15289 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15290 | { |
| 15291 | unsigned int present; |
| 15292 | unsigned char bits; |
| 15293 | |
| 15294 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15295 | AC_VERB_GET_PIN_SENSE, 0) |
| 15296 | & AC_PINSENSE_PRESENCE; |
| 15297 | bits = present ? HDA_AMP_MUTE : 0; |
| 15298 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15299 | AMP_IN_MUTE(0), bits); |
| 15300 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15301 | AMP_IN_MUTE(0), bits); |
| 15302 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15303 | AMP_IN_MUTE(0), bits); |
| 15304 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15305 | AMP_IN_MUTE(0), bits); |
| 15306 | } |
| 15307 | |
| 15308 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15309 | { |
| 15310 | unsigned int present; |
| 15311 | unsigned char bits; |
| 15312 | |
| 15313 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15314 | AC_VERB_GET_PIN_SENSE, 0) |
| 15315 | & AC_PINSENSE_PRESENCE; |
| 15316 | bits = present ? 0 : PIN_OUT; |
| 15317 | snd_hda_codec_write(codec, 0x14, 0, |
| 15318 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15319 | } |
| 15320 | |
| 15321 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15322 | { |
| 15323 | unsigned int present1, present2; |
| 15324 | |
| 15325 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15326 | AC_VERB_GET_PIN_SENSE, 0) |
| 15327 | & AC_PINSENSE_PRESENCE; |
| 15328 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15329 | AC_VERB_GET_PIN_SENSE, 0) |
| 15330 | & AC_PINSENSE_PRESENCE; |
| 15331 | |
| 15332 | if (present1 || present2) { |
| 15333 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15334 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 15335 | } else { |
| 15336 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15337 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 15338 | } |
| 15339 | } |
| 15340 | |
| 15341 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 15342 | { |
| 15343 | unsigned int present1, present2; |
| 15344 | |
| 15345 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 15346 | AC_VERB_GET_PIN_SENSE, 0) |
| 15347 | & AC_PINSENSE_PRESENCE; |
| 15348 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15349 | AC_VERB_GET_PIN_SENSE, 0) |
| 15350 | & AC_PINSENSE_PRESENCE; |
| 15351 | |
| 15352 | if (present1 || present2) { |
| 15353 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15354 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15355 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15356 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15357 | } else { |
| 15358 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15359 | AMP_IN_MUTE(0), 0); |
| 15360 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15361 | AMP_IN_MUTE(0), 0); |
| 15362 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15363 | } |
| 15364 | |
| 15365 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 15366 | { |
| 15367 | unsigned int present; |
| 15368 | |
| 15369 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15370 | AC_VERB_GET_PIN_SENSE, 0) |
| 15371 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15372 | 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] | 15373 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15374 | 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] | 15375 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
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 | (0x09 << 8) | (present ? 0x80 : 0)); |
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 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15380 | } |
| 15381 | |
| 15382 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 15383 | unsigned int res) |
| 15384 | { |
| 15385 | switch (res >> 26) { |
| 15386 | case ALC880_HP_EVENT: |
| 15387 | alc663_m51va_speaker_automute(codec); |
| 15388 | break; |
| 15389 | case ALC880_MIC_EVENT: |
| 15390 | alc663_m51va_mic_automute(codec); |
| 15391 | break; |
| 15392 | } |
| 15393 | } |
| 15394 | |
| 15395 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 15396 | { |
| 15397 | alc663_m51va_speaker_automute(codec); |
| 15398 | alc663_m51va_mic_automute(codec); |
| 15399 | } |
| 15400 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15401 | /* ***************** Mode1 ******************************/ |
| 15402 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 15403 | unsigned int res) |
| 15404 | { |
| 15405 | switch (res >> 26) { |
| 15406 | case ALC880_HP_EVENT: |
| 15407 | alc663_m51va_speaker_automute(codec); |
| 15408 | break; |
| 15409 | case ALC880_MIC_EVENT: |
| 15410 | alc662_eeepc_mic_automute(codec); |
| 15411 | break; |
| 15412 | } |
| 15413 | } |
| 15414 | |
| 15415 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 15416 | { |
| 15417 | alc663_m51va_speaker_automute(codec); |
| 15418 | alc662_eeepc_mic_automute(codec); |
| 15419 | } |
| 15420 | /* ***************** Mode2 ******************************/ |
| 15421 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 15422 | unsigned int res) |
| 15423 | { |
| 15424 | switch (res >> 26) { |
| 15425 | case ALC880_HP_EVENT: |
| 15426 | alc662_f5z_speaker_automute(codec); |
| 15427 | break; |
| 15428 | case ALC880_MIC_EVENT: |
| 15429 | alc662_eeepc_mic_automute(codec); |
| 15430 | break; |
| 15431 | } |
| 15432 | } |
| 15433 | |
| 15434 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 15435 | { |
| 15436 | alc662_f5z_speaker_automute(codec); |
| 15437 | alc662_eeepc_mic_automute(codec); |
| 15438 | } |
| 15439 | /* ***************** Mode3 ******************************/ |
| 15440 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 15441 | unsigned int res) |
| 15442 | { |
| 15443 | switch (res >> 26) { |
| 15444 | case ALC880_HP_EVENT: |
| 15445 | alc663_two_hp_m1_speaker_automute(codec); |
| 15446 | break; |
| 15447 | case ALC880_MIC_EVENT: |
| 15448 | alc662_eeepc_mic_automute(codec); |
| 15449 | break; |
| 15450 | } |
| 15451 | } |
| 15452 | |
| 15453 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 15454 | { |
| 15455 | alc663_two_hp_m1_speaker_automute(codec); |
| 15456 | alc662_eeepc_mic_automute(codec); |
| 15457 | } |
| 15458 | /* ***************** Mode4 ******************************/ |
| 15459 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 15460 | unsigned int res) |
| 15461 | { |
| 15462 | switch (res >> 26) { |
| 15463 | case ALC880_HP_EVENT: |
| 15464 | alc663_21jd_two_speaker_automute(codec); |
| 15465 | break; |
| 15466 | case ALC880_MIC_EVENT: |
| 15467 | alc662_eeepc_mic_automute(codec); |
| 15468 | break; |
| 15469 | } |
| 15470 | } |
| 15471 | |
| 15472 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 15473 | { |
| 15474 | alc663_21jd_two_speaker_automute(codec); |
| 15475 | alc662_eeepc_mic_automute(codec); |
| 15476 | } |
| 15477 | /* ***************** Mode5 ******************************/ |
| 15478 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 15479 | unsigned int res) |
| 15480 | { |
| 15481 | switch (res >> 26) { |
| 15482 | case ALC880_HP_EVENT: |
| 15483 | alc663_15jd_two_speaker_automute(codec); |
| 15484 | break; |
| 15485 | case ALC880_MIC_EVENT: |
| 15486 | alc662_eeepc_mic_automute(codec); |
| 15487 | break; |
| 15488 | } |
| 15489 | } |
| 15490 | |
| 15491 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 15492 | { |
| 15493 | alc663_15jd_two_speaker_automute(codec); |
| 15494 | alc662_eeepc_mic_automute(codec); |
| 15495 | } |
| 15496 | /* ***************** Mode6 ******************************/ |
| 15497 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 15498 | unsigned int res) |
| 15499 | { |
| 15500 | switch (res >> 26) { |
| 15501 | case ALC880_HP_EVENT: |
| 15502 | alc663_two_hp_m2_speaker_automute(codec); |
| 15503 | break; |
| 15504 | case ALC880_MIC_EVENT: |
| 15505 | alc662_eeepc_mic_automute(codec); |
| 15506 | break; |
| 15507 | } |
| 15508 | } |
| 15509 | |
| 15510 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 15511 | { |
| 15512 | alc663_two_hp_m2_speaker_automute(codec); |
| 15513 | alc662_eeepc_mic_automute(codec); |
| 15514 | } |
| 15515 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15516 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 15517 | { |
| 15518 | unsigned int present; |
| 15519 | unsigned char bits; |
| 15520 | |
| 15521 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15522 | AC_VERB_GET_PIN_SENSE, 0) |
| 15523 | & AC_PINSENSE_PRESENCE; |
| 15524 | bits = present ? HDA_AMP_MUTE : 0; |
| 15525 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15526 | HDA_AMP_MUTE, bits); |
| 15527 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15528 | HDA_AMP_MUTE, bits); |
| 15529 | } |
| 15530 | |
| 15531 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 15532 | { |
| 15533 | unsigned int present; |
| 15534 | unsigned char bits; |
| 15535 | |
| 15536 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15537 | AC_VERB_GET_PIN_SENSE, 0) |
| 15538 | & AC_PINSENSE_PRESENCE; |
| 15539 | bits = present ? HDA_AMP_MUTE : 0; |
| 15540 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15541 | HDA_AMP_MUTE, bits); |
| 15542 | } |
| 15543 | |
| 15544 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 15545 | unsigned int res) |
| 15546 | { |
| 15547 | switch (res >> 26) { |
| 15548 | case ALC880_HP_EVENT: |
| 15549 | alc663_g71v_hp_automute(codec); |
| 15550 | break; |
| 15551 | case ALC880_FRONT_EVENT: |
| 15552 | alc663_g71v_front_automute(codec); |
| 15553 | break; |
| 15554 | case ALC880_MIC_EVENT: |
| 15555 | alc662_eeepc_mic_automute(codec); |
| 15556 | break; |
| 15557 | } |
| 15558 | } |
| 15559 | |
| 15560 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 15561 | { |
| 15562 | alc663_g71v_front_automute(codec); |
| 15563 | alc663_g71v_hp_automute(codec); |
| 15564 | alc662_eeepc_mic_automute(codec); |
| 15565 | } |
| 15566 | |
| 15567 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 15568 | unsigned int res) |
| 15569 | { |
| 15570 | switch (res >> 26) { |
| 15571 | case ALC880_HP_EVENT: |
| 15572 | alc663_m51va_speaker_automute(codec); |
| 15573 | break; |
| 15574 | case ALC880_MIC_EVENT: |
| 15575 | alc662_eeepc_mic_automute(codec); |
| 15576 | break; |
| 15577 | } |
| 15578 | } |
| 15579 | |
| 15580 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 15581 | { |
| 15582 | alc663_m51va_speaker_automute(codec); |
| 15583 | alc662_eeepc_mic_automute(codec); |
| 15584 | } |
| 15585 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15586 | /* bind hp and internal speaker mute (with plug check) */ |
| 15587 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 15588 | struct snd_ctl_elem_value *ucontrol) |
| 15589 | { |
| 15590 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 15591 | long *valp = ucontrol->value.integer.value; |
| 15592 | int change; |
| 15593 | |
| 15594 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 15595 | HDA_AMP_MUTE, |
| 15596 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 15597 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 15598 | HDA_AMP_MUTE, |
| 15599 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 15600 | if (change) |
| 15601 | alc262_hippo1_automute(codec); |
| 15602 | return change; |
| 15603 | } |
| 15604 | |
| 15605 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 15606 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15607 | { |
| 15608 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15609 | .name = "Master Playback Switch", |
| 15610 | .info = snd_hda_mixer_amp_switch_info, |
| 15611 | .get = snd_hda_mixer_amp_switch_get, |
| 15612 | .put = alc662_ecs_master_sw_put, |
| 15613 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15614 | }, |
| 15615 | |
| 15616 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 15617 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15618 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15619 | |
| 15620 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15621 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15622 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15623 | { } /* end */ |
| 15624 | }; |
| 15625 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15626 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15627 | #define alc662_loopbacks alc880_loopbacks |
| 15628 | #endif |
| 15629 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15630 | |
| 15631 | /* pcm configuration: identiacal with ALC880 */ |
| 15632 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 15633 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 15634 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 15635 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 15636 | |
| 15637 | /* |
| 15638 | * configuration and preset |
| 15639 | */ |
| 15640 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 15641 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 15642 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 15643 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 15644 | [ALC662_5ST_DIG] = "6stack-dig", |
| 15645 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 15646 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15647 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15648 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15649 | [ALC663_ASUS_M51VA] = "m51va", |
| 15650 | [ALC663_ASUS_G71V] = "g71v", |
| 15651 | [ALC663_ASUS_H13] = "h13", |
| 15652 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15653 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 15654 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 15655 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 15656 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 15657 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 15658 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15659 | [ALC662_AUTO] = "auto", |
| 15660 | }; |
| 15661 | |
| 15662 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15663 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
| 15664 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 15665 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15666 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15667 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15668 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 15669 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), |
| 15670 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 15671 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 15672 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 15673 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15674 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15675 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 15676 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15677 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
| 15678 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 15679 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 15680 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
| 15681 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 15682 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 15683 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
| 15684 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 15685 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
| 15686 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 15687 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 15688 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
| 15689 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 15690 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 15691 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
| 15692 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
| 15693 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 15694 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
| 15695 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 15696 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 15697 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 15698 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 15699 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 15700 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15701 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15702 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
| 15703 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 15704 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 15705 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 15706 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 15707 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 15708 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15709 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
| 15710 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
| 15711 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15712 | {} |
| 15713 | }; |
| 15714 | |
| 15715 | static struct alc_config_preset alc662_presets[] = { |
| 15716 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15717 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15718 | .init_verbs = { alc662_init_verbs }, |
| 15719 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15720 | .dac_nids = alc662_dac_nids, |
| 15721 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15722 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15723 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15724 | .channel_mode = alc662_3ST_2ch_modes, |
| 15725 | .input_mux = &alc662_capture_source, |
| 15726 | }, |
| 15727 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15728 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 15729 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15730 | .init_verbs = { alc662_init_verbs }, |
| 15731 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15732 | .dac_nids = alc662_dac_nids, |
| 15733 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15734 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15735 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15736 | .channel_mode = alc662_3ST_6ch_modes, |
| 15737 | .need_dac_fix = 1, |
| 15738 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15739 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15740 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15741 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 15742 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15743 | .init_verbs = { alc662_init_verbs }, |
| 15744 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15745 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15746 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15747 | .channel_mode = alc662_3ST_6ch_modes, |
| 15748 | .need_dac_fix = 1, |
| 15749 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15750 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15751 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15752 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 15753 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15754 | .init_verbs = { alc662_init_verbs }, |
| 15755 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15756 | .dac_nids = alc662_dac_nids, |
| 15757 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15758 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15759 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 15760 | .channel_mode = alc662_5stack_modes, |
| 15761 | .input_mux = &alc662_capture_source, |
| 15762 | }, |
| 15763 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15764 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15765 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 15766 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15767 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15768 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15769 | .channel_mode = alc662_3ST_2ch_modes, |
| 15770 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 15771 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 15772 | .init_hook = alc662_lenovo_101e_all_automute, |
| 15773 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15774 | [ALC662_ASUS_EEEPC_P701] = { |
| 15775 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 15776 | .init_verbs = { alc662_init_verbs, |
| 15777 | alc662_eeepc_sue_init_verbs }, |
| 15778 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15779 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15780 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15781 | .channel_mode = alc662_3ST_2ch_modes, |
| 15782 | .input_mux = &alc662_eeepc_capture_source, |
| 15783 | .unsol_event = alc662_eeepc_unsol_event, |
| 15784 | .init_hook = alc662_eeepc_inithook, |
| 15785 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15786 | [ALC662_ASUS_EEEPC_EP20] = { |
| 15787 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 15788 | alc662_chmode_mixer }, |
| 15789 | .init_verbs = { alc662_init_verbs, |
| 15790 | alc662_eeepc_ep20_sue_init_verbs }, |
| 15791 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15792 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15793 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15794 | .channel_mode = alc662_3ST_6ch_modes, |
| 15795 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 15796 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 15797 | .init_hook = alc662_eeepc_ep20_inithook, |
| 15798 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15799 | [ALC662_ECS] = { |
| 15800 | .mixers = { alc662_ecs_mixer, alc662_capture_mixer }, |
| 15801 | .init_verbs = { alc662_init_verbs, |
| 15802 | alc662_ecs_init_verbs }, |
| 15803 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15804 | .dac_nids = alc662_dac_nids, |
| 15805 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15806 | .channel_mode = alc662_3ST_2ch_modes, |
| 15807 | .input_mux = &alc662_eeepc_capture_source, |
| 15808 | .unsol_event = alc662_eeepc_unsol_event, |
| 15809 | .init_hook = alc662_eeepc_inithook, |
| 15810 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15811 | [ALC663_ASUS_M51VA] = { |
| 15812 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 15813 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 15814 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15815 | .dac_nids = alc662_dac_nids, |
| 15816 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15817 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15818 | .channel_mode = alc662_3ST_2ch_modes, |
| 15819 | .input_mux = &alc663_m51va_capture_source, |
| 15820 | .unsol_event = alc663_m51va_unsol_event, |
| 15821 | .init_hook = alc663_m51va_inithook, |
| 15822 | }, |
| 15823 | [ALC663_ASUS_G71V] = { |
| 15824 | .mixers = { alc663_g71v_mixer, alc662_capture_mixer}, |
| 15825 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 15826 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15827 | .dac_nids = alc662_dac_nids, |
| 15828 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15829 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15830 | .channel_mode = alc662_3ST_2ch_modes, |
| 15831 | .input_mux = &alc662_eeepc_capture_source, |
| 15832 | .unsol_event = alc663_g71v_unsol_event, |
| 15833 | .init_hook = alc663_g71v_inithook, |
| 15834 | }, |
| 15835 | [ALC663_ASUS_H13] = { |
| 15836 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 15837 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 15838 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15839 | .dac_nids = alc662_dac_nids, |
| 15840 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15841 | .channel_mode = alc662_3ST_2ch_modes, |
| 15842 | .input_mux = &alc663_m51va_capture_source, |
| 15843 | .unsol_event = alc663_m51va_unsol_event, |
| 15844 | .init_hook = alc663_m51va_inithook, |
| 15845 | }, |
| 15846 | [ALC663_ASUS_G50V] = { |
| 15847 | .mixers = { alc663_g50v_mixer, alc662_capture_mixer}, |
| 15848 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 15849 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15850 | .dac_nids = alc662_dac_nids, |
| 15851 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15852 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15853 | .channel_mode = alc662_3ST_6ch_modes, |
| 15854 | .input_mux = &alc663_capture_source, |
| 15855 | .unsol_event = alc663_g50v_unsol_event, |
| 15856 | .init_hook = alc663_g50v_inithook, |
| 15857 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15858 | [ALC663_ASUS_MODE1] = { |
| 15859 | .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer }, |
| 15860 | .init_verbs = { alc662_init_verbs, |
| 15861 | alc663_21jd_amic_init_verbs }, |
| 15862 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15863 | .hp_nid = 0x03, |
| 15864 | .dac_nids = alc662_dac_nids, |
| 15865 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15866 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15867 | .channel_mode = alc662_3ST_2ch_modes, |
| 15868 | .input_mux = &alc662_eeepc_capture_source, |
| 15869 | .unsol_event = alc663_mode1_unsol_event, |
| 15870 | .init_hook = alc663_mode1_inithook, |
| 15871 | }, |
| 15872 | [ALC662_ASUS_MODE2] = { |
| 15873 | .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer }, |
| 15874 | .init_verbs = { alc662_init_verbs, |
| 15875 | alc662_1bjd_amic_init_verbs }, |
| 15876 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15877 | .dac_nids = alc662_dac_nids, |
| 15878 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15879 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15880 | .channel_mode = alc662_3ST_2ch_modes, |
| 15881 | .input_mux = &alc662_eeepc_capture_source, |
| 15882 | .unsol_event = alc662_mode2_unsol_event, |
| 15883 | .init_hook = alc662_mode2_inithook, |
| 15884 | }, |
| 15885 | [ALC663_ASUS_MODE3] = { |
| 15886 | .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer }, |
| 15887 | .init_verbs = { alc662_init_verbs, |
| 15888 | alc663_two_hp_amic_m1_init_verbs }, |
| 15889 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15890 | .hp_nid = 0x03, |
| 15891 | .dac_nids = alc662_dac_nids, |
| 15892 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15893 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15894 | .channel_mode = alc662_3ST_2ch_modes, |
| 15895 | .input_mux = &alc662_eeepc_capture_source, |
| 15896 | .unsol_event = alc663_mode3_unsol_event, |
| 15897 | .init_hook = alc663_mode3_inithook, |
| 15898 | }, |
| 15899 | [ALC663_ASUS_MODE4] = { |
| 15900 | .mixers = { alc663_asus_21jd_clfe_mixer, |
| 15901 | alc662_auto_capture_mixer}, |
| 15902 | .init_verbs = { alc662_init_verbs, |
| 15903 | alc663_21jd_amic_init_verbs}, |
| 15904 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15905 | .hp_nid = 0x03, |
| 15906 | .dac_nids = alc662_dac_nids, |
| 15907 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15908 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15909 | .channel_mode = alc662_3ST_2ch_modes, |
| 15910 | .input_mux = &alc662_eeepc_capture_source, |
| 15911 | .unsol_event = alc663_mode4_unsol_event, |
| 15912 | .init_hook = alc663_mode4_inithook, |
| 15913 | }, |
| 15914 | [ALC663_ASUS_MODE5] = { |
| 15915 | .mixers = { alc663_asus_15jd_clfe_mixer, |
| 15916 | alc662_auto_capture_mixer }, |
| 15917 | .init_verbs = { alc662_init_verbs, |
| 15918 | alc663_15jd_amic_init_verbs }, |
| 15919 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15920 | .hp_nid = 0x03, |
| 15921 | .dac_nids = alc662_dac_nids, |
| 15922 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15923 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15924 | .channel_mode = alc662_3ST_2ch_modes, |
| 15925 | .input_mux = &alc662_eeepc_capture_source, |
| 15926 | .unsol_event = alc663_mode5_unsol_event, |
| 15927 | .init_hook = alc663_mode5_inithook, |
| 15928 | }, |
| 15929 | [ALC663_ASUS_MODE6] = { |
| 15930 | .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer }, |
| 15931 | .init_verbs = { alc662_init_verbs, |
| 15932 | alc663_two_hp_amic_m2_init_verbs }, |
| 15933 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15934 | .hp_nid = 0x03, |
| 15935 | .dac_nids = alc662_dac_nids, |
| 15936 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15937 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15938 | .channel_mode = alc662_3ST_2ch_modes, |
| 15939 | .input_mux = &alc662_eeepc_capture_source, |
| 15940 | .unsol_event = alc663_mode6_unsol_event, |
| 15941 | .init_hook = alc663_mode6_inithook, |
| 15942 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15943 | }; |
| 15944 | |
| 15945 | |
| 15946 | /* |
| 15947 | * BIOS auto configuration |
| 15948 | */ |
| 15949 | |
| 15950 | /* add playback controls from the parsed DAC table */ |
| 15951 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15952 | const struct auto_pin_cfg *cfg) |
| 15953 | { |
| 15954 | char name[32]; |
| 15955 | static const char *chname[4] = { |
| 15956 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15957 | }; |
| 15958 | hda_nid_t nid; |
| 15959 | int i, err; |
| 15960 | |
| 15961 | for (i = 0; i < cfg->line_outs; i++) { |
| 15962 | if (!spec->multiout.dac_nids[i]) |
| 15963 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15964 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15965 | if (i == 2) { |
| 15966 | /* Center/LFE */ |
| 15967 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15968 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15969 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 15970 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15971 | if (err < 0) |
| 15972 | return err; |
| 15973 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15974 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15975 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 15976 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15977 | if (err < 0) |
| 15978 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15979 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15980 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15981 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15982 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15983 | if (err < 0) |
| 15984 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15985 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15986 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15987 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15988 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15989 | if (err < 0) |
| 15990 | return err; |
| 15991 | } else { |
| 15992 | sprintf(name, "%s Playback Volume", chname[i]); |
| 15993 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15994 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 15995 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15996 | if (err < 0) |
| 15997 | return err; |
| 15998 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15999 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16000 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16001 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16002 | if (err < 0) |
| 16003 | return err; |
| 16004 | } |
| 16005 | } |
| 16006 | return 0; |
| 16007 | } |
| 16008 | |
| 16009 | /* add playback controls for speaker and HP outputs */ |
| 16010 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16011 | const char *pfx) |
| 16012 | { |
| 16013 | hda_nid_t nid; |
| 16014 | int err; |
| 16015 | char name[32]; |
| 16016 | |
| 16017 | if (!pin) |
| 16018 | return 0; |
| 16019 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16020 | if (pin == 0x17) { |
| 16021 | /* ALC663 has a mono output pin on 0x17 */ |
| 16022 | sprintf(name, "%s Playback Switch", pfx); |
| 16023 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16024 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16025 | return err; |
| 16026 | } |
| 16027 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16028 | if (alc880_is_fixed_pin(pin)) { |
| 16029 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16030 | /* printk("DAC nid=%x\n",nid); */ |
| 16031 | /* specify the DAC as the extra output */ |
| 16032 | if (!spec->multiout.hp_nid) |
| 16033 | spec->multiout.hp_nid = nid; |
| 16034 | else |
| 16035 | spec->multiout.extra_out_nid[0] = nid; |
| 16036 | /* control HP volume/switch on the output mixer amp */ |
| 16037 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16038 | sprintf(name, "%s Playback Volume", pfx); |
| 16039 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16040 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16041 | if (err < 0) |
| 16042 | return err; |
| 16043 | sprintf(name, "%s Playback Switch", pfx); |
| 16044 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16045 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16046 | if (err < 0) |
| 16047 | return err; |
| 16048 | } else if (alc880_is_multi_pin(pin)) { |
| 16049 | /* set manual connection */ |
| 16050 | /* we have only a switch on HP-out PIN */ |
| 16051 | sprintf(name, "%s Playback Switch", pfx); |
| 16052 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16053 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16054 | if (err < 0) |
| 16055 | return err; |
| 16056 | } |
| 16057 | return 0; |
| 16058 | } |
| 16059 | |
| 16060 | /* create playback/capture controls for input pins */ |
| 16061 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 16062 | const struct auto_pin_cfg *cfg) |
| 16063 | { |
| 16064 | struct hda_input_mux *imux = &spec->private_imux; |
| 16065 | int i, err, idx; |
| 16066 | |
| 16067 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16068 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 16069 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 16070 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16071 | auto_pin_cfg_labels[i], |
| 16072 | idx, 0x0b); |
| 16073 | if (err < 0) |
| 16074 | return err; |
| 16075 | imux->items[imux->num_items].label = |
| 16076 | auto_pin_cfg_labels[i]; |
| 16077 | imux->items[imux->num_items].index = |
| 16078 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 16079 | imux->num_items++; |
| 16080 | } |
| 16081 | } |
| 16082 | return 0; |
| 16083 | } |
| 16084 | |
| 16085 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16086 | hda_nid_t nid, int pin_type, |
| 16087 | int dac_idx) |
| 16088 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16089 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16090 | /* need the manual connection? */ |
| 16091 | if (alc880_is_multi_pin(nid)) { |
| 16092 | struct alc_spec *spec = codec->spec; |
| 16093 | int idx = alc880_multi_pin_idx(nid); |
| 16094 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16095 | AC_VERB_SET_CONNECT_SEL, |
| 16096 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16097 | } |
| 16098 | } |
| 16099 | |
| 16100 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16101 | { |
| 16102 | struct alc_spec *spec = codec->spec; |
| 16103 | int i; |
| 16104 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16105 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16106 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16107 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16108 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16109 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16110 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16111 | i); |
| 16112 | } |
| 16113 | } |
| 16114 | |
| 16115 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16116 | { |
| 16117 | struct alc_spec *spec = codec->spec; |
| 16118 | hda_nid_t pin; |
| 16119 | |
| 16120 | pin = spec->autocfg.hp_pins[0]; |
| 16121 | if (pin) /* connect to front */ |
| 16122 | /* use dac 0 */ |
| 16123 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16124 | pin = spec->autocfg.speaker_pins[0]; |
| 16125 | if (pin) |
| 16126 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16127 | } |
| 16128 | |
| 16129 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 16130 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16131 | |
| 16132 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16133 | { |
| 16134 | struct alc_spec *spec = codec->spec; |
| 16135 | int i; |
| 16136 | |
| 16137 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16138 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 16139 | if (alc662_is_input_pin(nid)) { |
| 16140 | snd_hda_codec_write(codec, nid, 0, |
| 16141 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16142 | (i <= AUTO_PIN_FRONT_MIC ? |
| 16143 | PIN_VREF80 : PIN_IN)); |
| 16144 | if (nid != ALC662_PIN_CD_NID) |
| 16145 | snd_hda_codec_write(codec, nid, 0, |
| 16146 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16147 | AMP_OUT_MUTE); |
| 16148 | } |
| 16149 | } |
| 16150 | } |
| 16151 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16152 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16153 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16154 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16155 | { |
| 16156 | struct alc_spec *spec = codec->spec; |
| 16157 | int err; |
| 16158 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16159 | |
| 16160 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16161 | alc662_ignore); |
| 16162 | if (err < 0) |
| 16163 | return err; |
| 16164 | if (!spec->autocfg.line_outs) |
| 16165 | return 0; /* can't find valid BIOS pin config */ |
| 16166 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16167 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16168 | if (err < 0) |
| 16169 | return err; |
| 16170 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16171 | if (err < 0) |
| 16172 | return err; |
| 16173 | err = alc662_auto_create_extra_out(spec, |
| 16174 | spec->autocfg.speaker_pins[0], |
| 16175 | "Speaker"); |
| 16176 | if (err < 0) |
| 16177 | return err; |
| 16178 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16179 | "Headphone"); |
| 16180 | if (err < 0) |
| 16181 | return err; |
| 16182 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 16183 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16184 | return err; |
| 16185 | |
| 16186 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16187 | |
| 16188 | if (spec->autocfg.dig_out_pin) |
| 16189 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16190 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame^] | 16191 | if (spec->kctls.list) |
| 16192 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16193 | |
| 16194 | spec->num_mux_defs = 1; |
| 16195 | spec->input_mux = &spec->private_imux; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16196 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16197 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16198 | if (codec->vendor_id == 0x10ec0663) |
| 16199 | spec->init_verbs[spec->num_init_verbs++] = |
| 16200 | alc663_auto_init_verbs; |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16201 | |
| 16202 | err = alc_auto_add_mic_boost(codec); |
| 16203 | if (err < 0) |
| 16204 | return err; |
| 16205 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16206 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 16207 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16208 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16209 | } |
| 16210 | |
| 16211 | /* additional initialization for auto-configuration model */ |
| 16212 | static void alc662_auto_init(struct hda_codec *codec) |
| 16213 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16214 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16215 | alc662_auto_init_multi_out(codec); |
| 16216 | alc662_auto_init_hp_out(codec); |
| 16217 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16218 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16219 | if (spec->unsol_event) |
| 16220 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16221 | } |
| 16222 | |
| 16223 | static int patch_alc662(struct hda_codec *codec) |
| 16224 | { |
| 16225 | struct alc_spec *spec; |
| 16226 | int err, board_config; |
| 16227 | |
| 16228 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16229 | if (!spec) |
| 16230 | return -ENOMEM; |
| 16231 | |
| 16232 | codec->spec = spec; |
| 16233 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16234 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16235 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16236 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16237 | alc662_models, |
| 16238 | alc662_cfg_tbl); |
| 16239 | if (board_config < 0) { |
| 16240 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16241 | "trying auto-probe from BIOS...\n"); |
| 16242 | board_config = ALC662_AUTO; |
| 16243 | } |
| 16244 | |
| 16245 | if (board_config == ALC662_AUTO) { |
| 16246 | /* automatic parse from the BIOS config */ |
| 16247 | err = alc662_parse_auto_config(codec); |
| 16248 | if (err < 0) { |
| 16249 | alc_free(codec); |
| 16250 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16251 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16252 | printk(KERN_INFO |
| 16253 | "hda_codec: Cannot set up configuration " |
| 16254 | "from BIOS. Using base mode...\n"); |
| 16255 | board_config = ALC662_3ST_2ch_DIG; |
| 16256 | } |
| 16257 | } |
| 16258 | |
| 16259 | if (board_config != ALC662_AUTO) |
| 16260 | setup_preset(spec, &alc662_presets[board_config]); |
| 16261 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16262 | if (codec->vendor_id == 0x10ec0663) { |
| 16263 | spec->stream_name_analog = "ALC663 Analog"; |
| 16264 | spec->stream_name_digital = "ALC663 Digital"; |
| 16265 | } else { |
| 16266 | spec->stream_name_analog = "ALC662 Analog"; |
| 16267 | spec->stream_name_digital = "ALC662 Digital"; |
| 16268 | } |
| 16269 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16270 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16271 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16272 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16273 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16274 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16275 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16276 | spec->adc_nids = alc662_adc_nids; |
| 16277 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16278 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16279 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16280 | spec->vmaster_nid = 0x02; |
| 16281 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16282 | codec->patch_ops = alc_patch_ops; |
| 16283 | if (board_config == ALC662_AUTO) |
| 16284 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16285 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16286 | if (!spec->loopback.amplist) |
| 16287 | spec->loopback.amplist = alc662_loopbacks; |
| 16288 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16289 | |
| 16290 | return 0; |
| 16291 | } |
| 16292 | |
| 16293 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16294 | * patch entries |
| 16295 | */ |
| 16296 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 16297 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16298 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16299 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 16300 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16301 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16302 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16303 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16304 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 16305 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 16306 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16307 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 16308 | .patch = patch_alc883 }, |
| 16309 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 16310 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16311 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16312 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16313 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16314 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 16315 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 16316 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 16317 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 16318 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16319 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16320 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16321 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16322 | {} /* terminator */ |
| 16323 | }; |