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 | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 213 | ALC883_ACER, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 214 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 215 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 216 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 217 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 218 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 219 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 220 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 221 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 222 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 223 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 224 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 225 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 226 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 227 | ALC883_FUJITSU_PI2515, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 228 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 229 | ALC888_ASUS_M90V, |
| 230 | ALC888_ASUS_EEE1601, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 231 | ALC883_AUTO, |
| 232 | ALC883_MODEL_LAST, |
| 233 | }; |
| 234 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 235 | /* for GPIO Poll */ |
| 236 | #define GPIO_MASK 0x03 |
| 237 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | struct alc_spec { |
| 239 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 240 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | unsigned int num_mixers; |
| 242 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 243 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 244 | * don't forget NULL |
| 245 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 246 | */ |
| 247 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 249 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | struct hda_pcm_stream *stream_analog_playback; |
| 251 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 252 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 253 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 255 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | struct hda_pcm_stream *stream_digital_playback; |
| 257 | struct hda_pcm_stream *stream_digital_capture; |
| 258 | |
| 259 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 260 | struct hda_multi_out multiout; /* playback set-up |
| 261 | * max_channels, dacs must be set |
| 262 | * dig_out_nid and hp_nid are optional |
| 263 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 264 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | |
| 266 | /* capture */ |
| 267 | unsigned int num_adc_nids; |
| 268 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 269 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 270 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | |
| 272 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 273 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | const struct hda_input_mux *input_mux; |
| 275 | unsigned int cur_mux[3]; |
| 276 | |
| 277 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 278 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 280 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | |
| 282 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 283 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 284 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 285 | /* dynamic controls, init_verbs and input_mux */ |
| 286 | struct auto_pin_cfg autocfg; |
| 287 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 288 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 289 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 290 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 291 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 292 | /* hooks */ |
| 293 | void (*init_hook)(struct hda_codec *codec); |
| 294 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 295 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 296 | /* for pin sensing */ |
| 297 | unsigned int sense_updated: 1; |
| 298 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 299 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 300 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 301 | /* for virtual master */ |
| 302 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 303 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 304 | struct hda_loopback_check loopback; |
| 305 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 306 | |
| 307 | /* for PLL fix */ |
| 308 | hda_nid_t pll_nid; |
| 309 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame^] | 310 | |
| 311 | #ifdef SND_HDA_NEEDS_RESUME |
| 312 | #define ALC_MAX_PINS 16 |
| 313 | unsigned int num_pins; |
| 314 | hda_nid_t pin_nids[ALC_MAX_PINS]; |
| 315 | unsigned int pin_cfgs[ALC_MAX_PINS]; |
| 316 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 317 | }; |
| 318 | |
| 319 | /* |
| 320 | * configuration template - to be copied to the spec instance |
| 321 | */ |
| 322 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 323 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 324 | * with spec |
| 325 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 326 | const struct hda_verb *init_verbs[5]; |
| 327 | unsigned int num_dacs; |
| 328 | hda_nid_t *dac_nids; |
| 329 | hda_nid_t dig_out_nid; /* optional */ |
| 330 | hda_nid_t hp_nid; /* optional */ |
| 331 | unsigned int num_adc_nids; |
| 332 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 333 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 334 | hda_nid_t dig_in_nid; |
| 335 | unsigned int num_channel_mode; |
| 336 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 337 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 338 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 339 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 340 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 341 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 342 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 343 | struct hda_amp_list *loopbacks; |
| 344 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | }; |
| 346 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | |
| 348 | /* |
| 349 | * input MUX handling |
| 350 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 351 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 352 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | { |
| 354 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 355 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 356 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 357 | if (mux_idx >= spec->num_mux_defs) |
| 358 | mux_idx = 0; |
| 359 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | } |
| 361 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 362 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 363 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | { |
| 365 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 366 | struct alc_spec *spec = codec->spec; |
| 367 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 368 | |
| 369 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 370 | return 0; |
| 371 | } |
| 372 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 373 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 374 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | { |
| 376 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 377 | struct alc_spec *spec = codec->spec; |
| 378 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 379 | 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] | 380 | hda_nid_t nid = spec->capsrc_nids ? |
| 381 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 382 | 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] | 383 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | } |
| 385 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 386 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | /* |
| 388 | * channel mode setting |
| 389 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 390 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 391 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | { |
| 393 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 394 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 395 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 396 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | } |
| 398 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 399 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 400 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | { |
| 402 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 403 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 404 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 405 | spec->num_channel_mode, |
| 406 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | } |
| 408 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 409 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 410 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | { |
| 412 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 413 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 414 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 415 | spec->num_channel_mode, |
| 416 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 417 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 418 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 419 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 420 | } |
| 421 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 423 | * 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] | 424 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 425 | * being part of a format specifier. Maximum allowed length of a value is |
| 426 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 427 | * |
| 428 | * Note: some retasking pin complexes seem to ignore requests for input |
| 429 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 430 | * are requested. Therefore order this list so that this behaviour will not |
| 431 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 432 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 433 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 434 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 435 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 436 | "Mic 50pc bias", "Mic 80pc bias", |
| 437 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 438 | }; |
| 439 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 440 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 441 | }; |
| 442 | /* 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] | 443 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 444 | * addition, "input" pins may or may not process the mic bias option |
| 445 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 446 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 447 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 448 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 449 | #define ALC_PIN_DIR_IN 0x00 |
| 450 | #define ALC_PIN_DIR_OUT 0x01 |
| 451 | #define ALC_PIN_DIR_INOUT 0x02 |
| 452 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 453 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 454 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 455 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 456 | * For each direction the minimum and maximum values are given. |
| 457 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 458 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 459 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 460 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 461 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 462 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 463 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 464 | }; |
| 465 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 466 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 467 | #define alc_pin_mode_n_items(_dir) \ |
| 468 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 469 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 470 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 471 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 472 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 473 | unsigned int item_num = uinfo->value.enumerated.item; |
| 474 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 475 | |
| 476 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 477 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 478 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 479 | |
| 480 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 481 | item_num = alc_pin_mode_min(dir); |
| 482 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 483 | return 0; |
| 484 | } |
| 485 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 486 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 487 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 488 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 489 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 490 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 491 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 492 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 493 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 494 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 495 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 496 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 497 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 498 | /* Find enumerated value for current pinctl setting */ |
| 499 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 500 | 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] | 501 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 502 | *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] | 503 | return 0; |
| 504 | } |
| 505 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 506 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 507 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 508 | { |
| 509 | signed int change; |
| 510 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 511 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 512 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 513 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 514 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 515 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 516 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 517 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 518 | 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] | 519 | val = alc_pin_mode_min(dir); |
| 520 | |
| 521 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 522 | if (change) { |
| 523 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 524 | snd_hda_codec_write_cache(codec, nid, 0, |
| 525 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 526 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 527 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 528 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 529 | * for the requested pin mode. Enum values of 2 or less are |
| 530 | * input modes. |
| 531 | * |
| 532 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 533 | * reduces noise slightly (particularly on input) so we'll |
| 534 | * do it. However, having both input and output buffers |
| 535 | * enabled simultaneously doesn't seem to be problematic if |
| 536 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 537 | */ |
| 538 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 539 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 540 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 541 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 542 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 543 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 544 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 545 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 546 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 547 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 548 | } |
| 549 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 550 | return change; |
| 551 | } |
| 552 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 553 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 554 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 555 | .info = alc_pin_mode_info, \ |
| 556 | .get = alc_pin_mode_get, \ |
| 557 | .put = alc_pin_mode_put, \ |
| 558 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 559 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 560 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 561 | * together using a mask with more than one bit set. This control is |
| 562 | * currently used only by the ALC260 test model. At this stage they are not |
| 563 | * needed for any "production" models. |
| 564 | */ |
| 565 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 566 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 567 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 568 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 569 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 570 | { |
| 571 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 572 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 573 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 574 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 575 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 576 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 577 | |
| 578 | *valp = (val & mask) != 0; |
| 579 | return 0; |
| 580 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 581 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 582 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 583 | { |
| 584 | signed int change; |
| 585 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 586 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 587 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 588 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 589 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 590 | AC_VERB_GET_GPIO_DATA, |
| 591 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 592 | |
| 593 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 594 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 595 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 596 | gpio_data &= ~mask; |
| 597 | else |
| 598 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 599 | snd_hda_codec_write_cache(codec, nid, 0, |
| 600 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 601 | |
| 602 | return change; |
| 603 | } |
| 604 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 605 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 606 | .info = alc_gpio_data_info, \ |
| 607 | .get = alc_gpio_data_get, \ |
| 608 | .put = alc_gpio_data_put, \ |
| 609 | .private_value = nid | (mask<<16) } |
| 610 | #endif /* CONFIG_SND_DEBUG */ |
| 611 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 612 | /* A switch control to allow the enabling of the digital IO pins on the |
| 613 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 614 | * to provide something in the test model allowing digital outputs to be |
| 615 | * identified if present. If models are found which can utilise these |
| 616 | * outputs a more complete mixer control can be devised for those models if |
| 617 | * necessary. |
| 618 | */ |
| 619 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 620 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 621 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 622 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 623 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 624 | { |
| 625 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 626 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 627 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 628 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 629 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 630 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 631 | |
| 632 | *valp = (val & mask) != 0; |
| 633 | return 0; |
| 634 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 635 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 636 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 637 | { |
| 638 | signed int change; |
| 639 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 640 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 641 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 642 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 643 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 644 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 645 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 646 | |
| 647 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 648 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 649 | if (val==0) |
| 650 | ctrl_data &= ~mask; |
| 651 | else |
| 652 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 653 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 654 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 655 | |
| 656 | return change; |
| 657 | } |
| 658 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 659 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 660 | .info = alc_spdif_ctrl_info, \ |
| 661 | .get = alc_spdif_ctrl_get, \ |
| 662 | .put = alc_spdif_ctrl_put, \ |
| 663 | .private_value = nid | (mask<<16) } |
| 664 | #endif /* CONFIG_SND_DEBUG */ |
| 665 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 666 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 667 | * Again, this is only used in the ALC26x test models to help identify when |
| 668 | * the EAPD line must be asserted for features to work. |
| 669 | */ |
| 670 | #ifdef CONFIG_SND_DEBUG |
| 671 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 672 | |
| 673 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 674 | struct snd_ctl_elem_value *ucontrol) |
| 675 | { |
| 676 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 677 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 678 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 679 | long *valp = ucontrol->value.integer.value; |
| 680 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 681 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 682 | |
| 683 | *valp = (val & mask) != 0; |
| 684 | return 0; |
| 685 | } |
| 686 | |
| 687 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 688 | struct snd_ctl_elem_value *ucontrol) |
| 689 | { |
| 690 | int change; |
| 691 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 692 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 693 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 694 | long val = *ucontrol->value.integer.value; |
| 695 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 696 | AC_VERB_GET_EAPD_BTLENABLE, |
| 697 | 0x00); |
| 698 | |
| 699 | /* Set/unset the masked control bit(s) as needed */ |
| 700 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 701 | if (!val) |
| 702 | ctrl_data &= ~mask; |
| 703 | else |
| 704 | ctrl_data |= mask; |
| 705 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 706 | ctrl_data); |
| 707 | |
| 708 | return change; |
| 709 | } |
| 710 | |
| 711 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 712 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 713 | .info = alc_eapd_ctrl_info, \ |
| 714 | .get = alc_eapd_ctrl_get, \ |
| 715 | .put = alc_eapd_ctrl_put, \ |
| 716 | .private_value = nid | (mask<<16) } |
| 717 | #endif /* CONFIG_SND_DEBUG */ |
| 718 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 719 | /* |
| 720 | * set up from the preset table |
| 721 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 722 | static void setup_preset(struct alc_spec *spec, |
| 723 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 724 | { |
| 725 | int i; |
| 726 | |
| 727 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 728 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 729 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 730 | i++) |
| 731 | spec->init_verbs[spec->num_init_verbs++] = |
| 732 | preset->init_verbs[i]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 733 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 734 | spec->channel_mode = preset->channel_mode; |
| 735 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 736 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 737 | |
| 738 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 739 | |
| 740 | spec->multiout.num_dacs = preset->num_dacs; |
| 741 | spec->multiout.dac_nids = preset->dac_nids; |
| 742 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 743 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 744 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 745 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 746 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 747 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 748 | spec->input_mux = preset->input_mux; |
| 749 | |
| 750 | spec->num_adc_nids = preset->num_adc_nids; |
| 751 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 752 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 753 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 754 | |
| 755 | spec->unsol_event = preset->unsol_event; |
| 756 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 757 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 758 | spec->loopback.amplist = preset->loopbacks; |
| 759 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 760 | } |
| 761 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 762 | /* Enable GPIO mask and set output */ |
| 763 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 764 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 765 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 766 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 767 | { } |
| 768 | }; |
| 769 | |
| 770 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 771 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 772 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 773 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 774 | { } |
| 775 | }; |
| 776 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 777 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 778 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 779 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 780 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 781 | { } |
| 782 | }; |
| 783 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 784 | /* |
| 785 | * Fix hardware PLL issue |
| 786 | * On some codecs, the analog PLL gating control must be off while |
| 787 | * the default value is 1. |
| 788 | */ |
| 789 | static void alc_fix_pll(struct hda_codec *codec) |
| 790 | { |
| 791 | struct alc_spec *spec = codec->spec; |
| 792 | unsigned int val; |
| 793 | |
| 794 | if (!spec->pll_nid) |
| 795 | return; |
| 796 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 797 | spec->pll_coef_idx); |
| 798 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 799 | AC_VERB_GET_PROC_COEF, 0); |
| 800 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 801 | spec->pll_coef_idx); |
| 802 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 803 | val & ~(1 << spec->pll_coef_bit)); |
| 804 | } |
| 805 | |
| 806 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 807 | unsigned int coef_idx, unsigned int coef_bit) |
| 808 | { |
| 809 | struct alc_spec *spec = codec->spec; |
| 810 | spec->pll_nid = nid; |
| 811 | spec->pll_coef_idx = coef_idx; |
| 812 | spec->pll_coef_bit = coef_bit; |
| 813 | alc_fix_pll(codec); |
| 814 | } |
| 815 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 816 | static void alc_sku_automute(struct hda_codec *codec) |
| 817 | { |
| 818 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 819 | unsigned int present; |
| 820 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 821 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 822 | |
| 823 | /* need to execute and sync at first */ |
| 824 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 825 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 826 | AC_VERB_GET_PIN_SENSE, 0); |
| 827 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 828 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 829 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 830 | } |
| 831 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 832 | static void alc_mic_automute(struct hda_codec *codec) |
| 833 | { |
| 834 | struct alc_spec *spec = codec->spec; |
| 835 | unsigned int present; |
| 836 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 837 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 838 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 839 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 840 | |
| 841 | capsrc_idx_mic = mic_nid - 0x18; |
| 842 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 843 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 844 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 845 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 846 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 847 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 848 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 849 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 850 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 851 | } |
| 852 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 853 | /* unsolicited event for HP jack sensing */ |
| 854 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 855 | { |
| 856 | if (codec->vendor_id == 0x10ec0880) |
| 857 | res >>= 28; |
| 858 | else |
| 859 | res >>= 26; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 860 | if (res == ALC880_HP_EVENT) |
| 861 | alc_sku_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 862 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 863 | if (res == ALC880_MIC_EVENT) |
| 864 | alc_mic_automute(codec); |
| 865 | } |
| 866 | |
| 867 | static void alc_inithook(struct hda_codec *codec) |
| 868 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 869 | alc_sku_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 870 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 871 | } |
| 872 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 873 | /* additional initialization for ALC888 variants */ |
| 874 | static void alc888_coef_init(struct hda_codec *codec) |
| 875 | { |
| 876 | unsigned int tmp; |
| 877 | |
| 878 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 879 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 880 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 881 | if ((tmp & 0xf0) == 2) |
| 882 | /* alc888S-VC */ |
| 883 | snd_hda_codec_read(codec, 0x20, 0, |
| 884 | AC_VERB_SET_PROC_COEF, 0x830); |
| 885 | else |
| 886 | /* alc888-VB */ |
| 887 | snd_hda_codec_read(codec, 0x20, 0, |
| 888 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 889 | } |
| 890 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 891 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 892 | * 31 ~ 16 : Manufacture ID |
| 893 | * 15 ~ 8 : SKU ID |
| 894 | * 7 ~ 0 : Assembly ID |
| 895 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 896 | */ |
| 897 | static void alc_subsystem_id(struct hda_codec *codec, |
| 898 | unsigned int porta, unsigned int porte, |
| 899 | unsigned int portd) |
| 900 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 901 | unsigned int ass, tmp, i; |
| 902 | unsigned nid; |
| 903 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 904 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 905 | ass = codec->subsystem_id & 0xffff; |
| 906 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 907 | goto do_sku; |
| 908 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 909 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 910 | * 31~30 : port conetcivity |
| 911 | * 29~21 : reserve |
| 912 | * 20 : PCBEEP input |
| 913 | * 19~16 : Check sum (15:1) |
| 914 | * 15~1 : Custom |
| 915 | * 0 : override |
| 916 | */ |
| 917 | nid = 0x1d; |
| 918 | if (codec->vendor_id == 0x10ec0260) |
| 919 | nid = 0x17; |
| 920 | ass = snd_hda_codec_read(codec, nid, 0, |
| 921 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 922 | if (!(ass & 1) && !(ass & 0x100000)) |
| 923 | return; |
| 924 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 925 | return; |
| 926 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 927 | /* check sum */ |
| 928 | tmp = 0; |
| 929 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 930 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 931 | tmp++; |
| 932 | } |
| 933 | if (((ass >> 16) & 0xf) != tmp) |
| 934 | return; |
| 935 | do_sku: |
| 936 | /* |
| 937 | * 0 : override |
| 938 | * 1 : Swap Jack |
| 939 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 940 | * 3~5 : External Amplifier control |
| 941 | * 7~6 : Reserved |
| 942 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 943 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 944 | switch (tmp) { |
| 945 | case 1: |
| 946 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 947 | break; |
| 948 | case 3: |
| 949 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 950 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 951 | case 7: |
| 952 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 953 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 954 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 955 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 956 | case 0x10ec0260: |
| 957 | snd_hda_codec_write(codec, 0x0f, 0, |
| 958 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 959 | snd_hda_codec_write(codec, 0x10, 0, |
| 960 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 961 | break; |
| 962 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 963 | case 0x10ec0267: |
| 964 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 965 | case 0x10ec0269: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 966 | case 0x10ec0660: |
| 967 | case 0x10ec0662: |
| 968 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 969 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 970 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 971 | snd_hda_codec_write(codec, 0x14, 0, |
| 972 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 973 | snd_hda_codec_write(codec, 0x15, 0, |
| 974 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 975 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 976 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 977 | switch (codec->vendor_id) { |
| 978 | case 0x10ec0260: |
| 979 | snd_hda_codec_write(codec, 0x1a, 0, |
| 980 | AC_VERB_SET_COEF_INDEX, 7); |
| 981 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 982 | AC_VERB_GET_PROC_COEF, 0); |
| 983 | snd_hda_codec_write(codec, 0x1a, 0, |
| 984 | AC_VERB_SET_COEF_INDEX, 7); |
| 985 | snd_hda_codec_write(codec, 0x1a, 0, |
| 986 | AC_VERB_SET_PROC_COEF, |
| 987 | tmp | 0x2010); |
| 988 | break; |
| 989 | case 0x10ec0262: |
| 990 | case 0x10ec0880: |
| 991 | case 0x10ec0882: |
| 992 | case 0x10ec0883: |
| 993 | case 0x10ec0885: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 994 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 995 | snd_hda_codec_write(codec, 0x20, 0, |
| 996 | AC_VERB_SET_COEF_INDEX, 7); |
| 997 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 998 | AC_VERB_GET_PROC_COEF, 0); |
| 999 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1000 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1001 | snd_hda_codec_write(codec, 0x20, 0, |
| 1002 | AC_VERB_SET_PROC_COEF, |
| 1003 | tmp | 0x2010); |
| 1004 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1005 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 1006 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1007 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1008 | case 0x10ec0267: |
| 1009 | case 0x10ec0268: |
| 1010 | snd_hda_codec_write(codec, 0x20, 0, |
| 1011 | AC_VERB_SET_COEF_INDEX, 7); |
| 1012 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1013 | AC_VERB_GET_PROC_COEF, 0); |
| 1014 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1015 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1016 | snd_hda_codec_write(codec, 0x20, 0, |
| 1017 | AC_VERB_SET_PROC_COEF, |
| 1018 | tmp | 0x3000); |
| 1019 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1020 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1021 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1022 | break; |
| 1023 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1024 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1025 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1026 | * when the external headphone out jack is plugged" |
| 1027 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1028 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1029 | return; |
| 1030 | /* |
| 1031 | * 10~8 : Jack location |
| 1032 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1033 | * 14~13: Resvered |
| 1034 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1035 | * when the external headphone out jack is plugged" |
| 1036 | */ |
| 1037 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1038 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1039 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1040 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1041 | else |
| 1042 | return; |
| 1043 | } |
| 1044 | |
| 1045 | if (!spec->autocfg.hp_pins[0]) { |
| 1046 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1047 | if (tmp == 0) |
| 1048 | spec->autocfg.hp_pins[0] = porta; |
| 1049 | else if (tmp == 1) |
| 1050 | spec->autocfg.hp_pins[0] = porte; |
| 1051 | else if (tmp == 2) |
| 1052 | spec->autocfg.hp_pins[0] = portd; |
| 1053 | else |
| 1054 | return; |
| 1055 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1056 | if (spec->autocfg.hp_pins[0]) |
| 1057 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1058 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1059 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1060 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1061 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
| 1062 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) |
| 1063 | snd_hda_codec_write(codec, |
| 1064 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, |
| 1065 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1066 | AC_USRSP_EN | ALC880_MIC_EVENT); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1067 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1068 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1069 | } |
| 1070 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1071 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1072 | * Fix-up pin default configurations |
| 1073 | */ |
| 1074 | |
| 1075 | struct alc_pincfg { |
| 1076 | hda_nid_t nid; |
| 1077 | u32 val; |
| 1078 | }; |
| 1079 | |
| 1080 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1081 | const struct snd_pci_quirk *quirk, |
| 1082 | const struct alc_pincfg **pinfix) |
| 1083 | { |
| 1084 | const struct alc_pincfg *cfg; |
| 1085 | |
| 1086 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1087 | if (!quirk) |
| 1088 | return; |
| 1089 | |
| 1090 | cfg = pinfix[quirk->value]; |
| 1091 | for (; cfg->nid; cfg++) { |
| 1092 | int i; |
| 1093 | u32 val = cfg->val; |
| 1094 | for (i = 0; i < 4; i++) { |
| 1095 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1096 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1097 | val & 0xff); |
| 1098 | val >>= 8; |
| 1099 | } |
| 1100 | } |
| 1101 | } |
| 1102 | |
| 1103 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1104 | * ALC880 3-stack model |
| 1105 | * |
| 1106 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1107 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1108 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1109 | */ |
| 1110 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1111 | static hda_nid_t alc880_dac_nids[4] = { |
| 1112 | /* front, rear, clfe, rear_surr */ |
| 1113 | 0x02, 0x05, 0x04, 0x03 |
| 1114 | }; |
| 1115 | |
| 1116 | static hda_nid_t alc880_adc_nids[3] = { |
| 1117 | /* ADC0-2 */ |
| 1118 | 0x07, 0x08, 0x09, |
| 1119 | }; |
| 1120 | |
| 1121 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1122 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1123 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1124 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1125 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1126 | /* ADC1-2 */ |
| 1127 | 0x08, 0x09, |
| 1128 | }; |
| 1129 | |
| 1130 | #define ALC880_DIGOUT_NID 0x06 |
| 1131 | #define ALC880_DIGIN_NID 0x0a |
| 1132 | |
| 1133 | static struct hda_input_mux alc880_capture_source = { |
| 1134 | .num_items = 4, |
| 1135 | .items = { |
| 1136 | { "Mic", 0x0 }, |
| 1137 | { "Front Mic", 0x3 }, |
| 1138 | { "Line", 0x2 }, |
| 1139 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1140 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1141 | }; |
| 1142 | |
| 1143 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1144 | /* 2ch mode */ |
| 1145 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1146 | /* set line-in to input, mute it */ |
| 1147 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1148 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1149 | /* set mic-in to input vref 80%, mute it */ |
| 1150 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1151 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1152 | { } /* end */ |
| 1153 | }; |
| 1154 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1155 | /* 6ch mode */ |
| 1156 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1157 | /* set line-in to output, unmute it */ |
| 1158 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1159 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1160 | /* set mic-in to output, unmute it */ |
| 1161 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1162 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1163 | { } /* end */ |
| 1164 | }; |
| 1165 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1166 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1167 | { 2, alc880_threestack_ch2_init }, |
| 1168 | { 6, alc880_threestack_ch6_init }, |
| 1169 | }; |
| 1170 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1171 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1172 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1173 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1174 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1175 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1176 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1177 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1178 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1179 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1180 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1181 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1182 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1183 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1184 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1185 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1186 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1187 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1188 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1189 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1190 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1191 | { |
| 1192 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1193 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1194 | .info = alc_ch_mode_info, |
| 1195 | .get = alc_ch_mode_get, |
| 1196 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1197 | }, |
| 1198 | { } /* end */ |
| 1199 | }; |
| 1200 | |
| 1201 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1202 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1203 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1204 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1205 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1206 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1207 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1208 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1209 | { |
| 1210 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1211 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1212 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1213 | */ |
| 1214 | /* .name = "Capture Source", */ |
| 1215 | .name = "Input Source", |
| 1216 | .count = 3, |
| 1217 | .info = alc_mux_enum_info, |
| 1218 | .get = alc_mux_enum_get, |
| 1219 | .put = alc_mux_enum_put, |
| 1220 | }, |
| 1221 | { } /* end */ |
| 1222 | }; |
| 1223 | |
| 1224 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1225 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1226 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1227 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1228 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1229 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1230 | { |
| 1231 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1232 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1233 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1234 | */ |
| 1235 | /* .name = "Capture Source", */ |
| 1236 | .name = "Input Source", |
| 1237 | .count = 2, |
| 1238 | .info = alc_mux_enum_info, |
| 1239 | .get = alc_mux_enum_get, |
| 1240 | .put = alc_mux_enum_put, |
| 1241 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1242 | { } /* end */ |
| 1243 | }; |
| 1244 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1245 | |
| 1246 | |
| 1247 | /* |
| 1248 | * ALC880 5-stack model |
| 1249 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1250 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1251 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1252 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1253 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1254 | */ |
| 1255 | |
| 1256 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1257 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1258 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1259 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1260 | { } /* end */ |
| 1261 | }; |
| 1262 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1263 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1264 | /* 6ch mode */ |
| 1265 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1266 | /* set line-in to input, mute it */ |
| 1267 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1268 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1269 | { } /* end */ |
| 1270 | }; |
| 1271 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1272 | /* 8ch mode */ |
| 1273 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1274 | /* set line-in to output, unmute it */ |
| 1275 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1276 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1277 | { } /* end */ |
| 1278 | }; |
| 1279 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1280 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1281 | { 6, alc880_fivestack_ch6_init }, |
| 1282 | { 8, alc880_fivestack_ch8_init }, |
| 1283 | }; |
| 1284 | |
| 1285 | |
| 1286 | /* |
| 1287 | * ALC880 6-stack model |
| 1288 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1289 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1290 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1291 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1292 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1293 | */ |
| 1294 | |
| 1295 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1296 | /* front, rear, clfe, rear_surr */ |
| 1297 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1298 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1299 | |
| 1300 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1301 | .num_items = 4, |
| 1302 | .items = { |
| 1303 | { "Mic", 0x0 }, |
| 1304 | { "Front Mic", 0x1 }, |
| 1305 | { "Line", 0x2 }, |
| 1306 | { "CD", 0x4 }, |
| 1307 | }, |
| 1308 | }; |
| 1309 | |
| 1310 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1311 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1312 | { 8, NULL }, |
| 1313 | }; |
| 1314 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1315 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1316 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1317 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1318 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1319 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1320 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1321 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1322 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1323 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1324 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1325 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1326 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1327 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1328 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1329 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1330 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1331 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1332 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1333 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1334 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1335 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1336 | { |
| 1337 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1338 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1339 | .info = alc_ch_mode_info, |
| 1340 | .get = alc_ch_mode_get, |
| 1341 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1342 | }, |
| 1343 | { } /* end */ |
| 1344 | }; |
| 1345 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1346 | |
| 1347 | /* |
| 1348 | * ALC880 W810 model |
| 1349 | * |
| 1350 | * W810 has rear IO for: |
| 1351 | * Front (DAC 02) |
| 1352 | * Surround (DAC 03) |
| 1353 | * Center/LFE (DAC 04) |
| 1354 | * Digital out (06) |
| 1355 | * |
| 1356 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1357 | * 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] | 1358 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1359 | * There is a variable resistor to control the speaker or headphone |
| 1360 | * volume. This is a hardware-only device without a software API. |
| 1361 | * |
| 1362 | * Plugging headphones in will disable the internal speakers. This is |
| 1363 | * implemented in hardware, not via the driver using jack sense. In |
| 1364 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1365 | * disable both the speakers and headphones. |
| 1366 | * |
| 1367 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1368 | * These may not do anything useful with this driver yet, because I |
| 1369 | * haven't setup any initialization verbs for these yet... |
| 1370 | */ |
| 1371 | |
| 1372 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1373 | /* front, rear/surround, clfe */ |
| 1374 | 0x02, 0x03, 0x04 |
| 1375 | }; |
| 1376 | |
| 1377 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1378 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1379 | { 6, NULL } |
| 1380 | }; |
| 1381 | |
| 1382 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1383 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1384 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1385 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1386 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1387 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1388 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1389 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1390 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1391 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1392 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1393 | { } /* end */ |
| 1394 | }; |
| 1395 | |
| 1396 | |
| 1397 | /* |
| 1398 | * Z710V model |
| 1399 | * |
| 1400 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1401 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1402 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1403 | */ |
| 1404 | |
| 1405 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1406 | 0x02 |
| 1407 | }; |
| 1408 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1409 | |
| 1410 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1411 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1412 | { 2, NULL } |
| 1413 | }; |
| 1414 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1415 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1416 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1417 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1418 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1419 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1420 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1421 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1422 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1423 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1424 | { } /* end */ |
| 1425 | }; |
| 1426 | |
| 1427 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1428 | /* |
| 1429 | * ALC880 F1734 model |
| 1430 | * |
| 1431 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1432 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1433 | */ |
| 1434 | |
| 1435 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1436 | 0x03 |
| 1437 | }; |
| 1438 | #define ALC880_F1734_HP_DAC 0x02 |
| 1439 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1440 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1441 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1442 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1443 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1444 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1445 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1446 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1447 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1448 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1449 | { } /* end */ |
| 1450 | }; |
| 1451 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1452 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1453 | .num_items = 2, |
| 1454 | .items = { |
| 1455 | { "Mic", 0x1 }, |
| 1456 | { "CD", 0x4 }, |
| 1457 | }, |
| 1458 | }; |
| 1459 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1460 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1461 | /* |
| 1462 | * ALC880 ASUS model |
| 1463 | * |
| 1464 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1465 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1466 | * Mic = 0x18, Line = 0x1a |
| 1467 | */ |
| 1468 | |
| 1469 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1470 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1471 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1472 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1473 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1474 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1475 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1476 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1477 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1478 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1479 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1480 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1484 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1485 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1486 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1487 | { |
| 1488 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1489 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1490 | .info = alc_ch_mode_info, |
| 1491 | .get = alc_ch_mode_get, |
| 1492 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1493 | }, |
| 1494 | { } /* end */ |
| 1495 | }; |
| 1496 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1497 | /* |
| 1498 | * ALC880 ASUS W1V model |
| 1499 | * |
| 1500 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1501 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1502 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1503 | */ |
| 1504 | |
| 1505 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1506 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1507 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1508 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1509 | { } /* end */ |
| 1510 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1511 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1512 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1513 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1514 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1515 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1516 | { } /* end */ |
| 1517 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1518 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1519 | /* TCL S700 */ |
| 1520 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1521 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1522 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1523 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1524 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1525 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1526 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1527 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1528 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1529 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1530 | { |
| 1531 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1532 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1533 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1534 | */ |
| 1535 | /* .name = "Capture Source", */ |
| 1536 | .name = "Input Source", |
| 1537 | .count = 1, |
| 1538 | .info = alc_mux_enum_info, |
| 1539 | .get = alc_mux_enum_get, |
| 1540 | .put = alc_mux_enum_put, |
| 1541 | }, |
| 1542 | { } /* end */ |
| 1543 | }; |
| 1544 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1545 | /* Uniwill */ |
| 1546 | static struct snd_kcontrol_new alc880_uniwill_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_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1552 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1553 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1554 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1555 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1556 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1557 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1558 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1559 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1560 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1561 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1562 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1563 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1564 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1565 | { |
| 1566 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1567 | .name = "Channel Mode", |
| 1568 | .info = alc_ch_mode_info, |
| 1569 | .get = alc_ch_mode_get, |
| 1570 | .put = alc_ch_mode_put, |
| 1571 | }, |
| 1572 | { } /* end */ |
| 1573 | }; |
| 1574 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1575 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1576 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1577 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1578 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1579 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1580 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1581 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1582 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1583 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1584 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1585 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1586 | { } /* end */ |
| 1587 | }; |
| 1588 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1589 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1590 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1591 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1592 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1593 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1594 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1595 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1596 | { } /* end */ |
| 1597 | }; |
| 1598 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1599 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1600 | * virtual master controls |
| 1601 | */ |
| 1602 | |
| 1603 | /* |
| 1604 | * slave controls for virtual master |
| 1605 | */ |
| 1606 | static const char *alc_slave_vols[] = { |
| 1607 | "Front Playback Volume", |
| 1608 | "Surround Playback Volume", |
| 1609 | "Center Playback Volume", |
| 1610 | "LFE Playback Volume", |
| 1611 | "Side Playback Volume", |
| 1612 | "Headphone Playback Volume", |
| 1613 | "Speaker Playback Volume", |
| 1614 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1615 | "Line-Out Playback Volume", |
| 1616 | NULL, |
| 1617 | }; |
| 1618 | |
| 1619 | static const char *alc_slave_sws[] = { |
| 1620 | "Front Playback Switch", |
| 1621 | "Surround Playback Switch", |
| 1622 | "Center Playback Switch", |
| 1623 | "LFE Playback Switch", |
| 1624 | "Side Playback Switch", |
| 1625 | "Headphone Playback Switch", |
| 1626 | "Speaker Playback Switch", |
| 1627 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1628 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1629 | NULL, |
| 1630 | }; |
| 1631 | |
| 1632 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1633 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1634 | */ |
| 1635 | static int alc_build_controls(struct hda_codec *codec) |
| 1636 | { |
| 1637 | struct alc_spec *spec = codec->spec; |
| 1638 | int err; |
| 1639 | int i; |
| 1640 | |
| 1641 | for (i = 0; i < spec->num_mixers; i++) { |
| 1642 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1643 | if (err < 0) |
| 1644 | return err; |
| 1645 | } |
| 1646 | |
| 1647 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1648 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1649 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1650 | if (err < 0) |
| 1651 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1652 | err = snd_hda_create_spdif_share_sw(codec, |
| 1653 | &spec->multiout); |
| 1654 | if (err < 0) |
| 1655 | return err; |
| 1656 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1657 | } |
| 1658 | if (spec->dig_in_nid) { |
| 1659 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1660 | if (err < 0) |
| 1661 | return err; |
| 1662 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1663 | |
| 1664 | /* if we have no master control, let's create it */ |
| 1665 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1666 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1667 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1668 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1669 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1670 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1671 | if (err < 0) |
| 1672 | return err; |
| 1673 | } |
| 1674 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1675 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1676 | NULL, alc_slave_sws); |
| 1677 | if (err < 0) |
| 1678 | return err; |
| 1679 | } |
| 1680 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1681 | return 0; |
| 1682 | } |
| 1683 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1684 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1685 | /* |
| 1686 | * initialize the codec volumes, etc |
| 1687 | */ |
| 1688 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1689 | /* |
| 1690 | * generic initialization of ADC, input mixers and output mixers |
| 1691 | */ |
| 1692 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1693 | /* |
| 1694 | * Unmute ADC0-2 and set the default input to mic-in |
| 1695 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1696 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1698 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1699 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1700 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1701 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1702 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1703 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1704 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1705 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1706 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1707 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1708 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1709 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1710 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1711 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1712 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1713 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1714 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1715 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1716 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1717 | /* |
| 1718 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1719 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1720 | /* set vol=0 to output mixers */ |
| 1721 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1722 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1723 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1724 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1725 | /* set up input amps for analog loopback */ |
| 1726 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1727 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1728 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1729 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1730 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1731 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1732 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1733 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1734 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1735 | |
| 1736 | { } |
| 1737 | }; |
| 1738 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1739 | /* |
| 1740 | * 3-stack pin configuration: |
| 1741 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1742 | */ |
| 1743 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1744 | /* |
| 1745 | * preset connection lists of input pins |
| 1746 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1747 | */ |
| 1748 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1749 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1750 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1751 | |
| 1752 | /* |
| 1753 | * Set pin mode and muting |
| 1754 | */ |
| 1755 | /* set front pin widgets 0x14 for output */ |
| 1756 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1757 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1758 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1759 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1760 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1761 | /* Mic2 (as headphone out) for HP output */ |
| 1762 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1763 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1764 | /* Line In pin widget for input */ |
| 1765 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1766 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1767 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1768 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1769 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1770 | /* CD pin widget for input */ |
| 1771 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1772 | |
| 1773 | { } |
| 1774 | }; |
| 1775 | |
| 1776 | /* |
| 1777 | * 5-stack pin configuration: |
| 1778 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1779 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1780 | */ |
| 1781 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1782 | /* |
| 1783 | * preset connection lists of input pins |
| 1784 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1785 | */ |
| 1786 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1787 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1788 | |
| 1789 | /* |
| 1790 | * Set pin mode and muting |
| 1791 | */ |
| 1792 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1793 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1794 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1795 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1796 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1797 | /* unmute pins for output (no gain on this amp) */ |
| 1798 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1799 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1800 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1801 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1802 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1803 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1804 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1805 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1806 | /* Mic2 (as headphone out) for HP output */ |
| 1807 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1808 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1809 | /* Line In pin widget for input */ |
| 1810 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1811 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1812 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1813 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1814 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1815 | /* CD pin widget for input */ |
| 1816 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1817 | |
| 1818 | { } |
| 1819 | }; |
| 1820 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1821 | /* |
| 1822 | * W810 pin configuration: |
| 1823 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1824 | */ |
| 1825 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1826 | /* hphone/speaker input selector: front DAC */ |
| 1827 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1828 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1829 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1830 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1831 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1832 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1833 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1834 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1835 | |
| 1836 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1837 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1838 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1839 | { } |
| 1840 | }; |
| 1841 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1842 | /* |
| 1843 | * Z71V pin configuration: |
| 1844 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1845 | */ |
| 1846 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1847 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1848 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1849 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1850 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1851 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1852 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1853 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1854 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1855 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1856 | |
| 1857 | { } |
| 1858 | }; |
| 1859 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1860 | /* |
| 1861 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1862 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1863 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1864 | */ |
| 1865 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1866 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1867 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1868 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1869 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1870 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1871 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1872 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1873 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1874 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1875 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1876 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1877 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1878 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1879 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1880 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1881 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1882 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1883 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1884 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1885 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1886 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1887 | { } |
| 1888 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1889 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1890 | /* |
| 1891 | * Uniwill pin configuration: |
| 1892 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1893 | * line = 0x1a |
| 1894 | */ |
| 1895 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1896 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1897 | |
| 1898 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1899 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1900 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1901 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1902 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1903 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1904 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1905 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1906 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1907 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1908 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1909 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1910 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1911 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1912 | |
| 1913 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1914 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1915 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1916 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1917 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1918 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1919 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1920 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1921 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1922 | |
| 1923 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1924 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1925 | |
| 1926 | { } |
| 1927 | }; |
| 1928 | |
| 1929 | /* |
| 1930 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1931 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1932 | */ |
| 1933 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1934 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1935 | |
| 1936 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1937 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1938 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1939 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1940 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1941 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1942 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1943 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1944 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1945 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1946 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1947 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1948 | |
| 1949 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1950 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1951 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1952 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1953 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1954 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1955 | |
| 1956 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1957 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1958 | |
| 1959 | { } |
| 1960 | }; |
| 1961 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1962 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1963 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1964 | { } |
| 1965 | }; |
| 1966 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1967 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1968 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1969 | { |
| 1970 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1971 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1972 | |
| 1973 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1974 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1975 | bits = present ? HDA_AMP_MUTE : 0; |
| 1976 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1977 | HDA_AMP_MUTE, bits); |
| 1978 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1979 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1980 | } |
| 1981 | |
| 1982 | /* auto-toggle front mic */ |
| 1983 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1984 | { |
| 1985 | unsigned int present; |
| 1986 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1987 | |
| 1988 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1989 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1990 | bits = present ? HDA_AMP_MUTE : 0; |
| 1991 | 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] | 1992 | } |
| 1993 | |
| 1994 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1995 | { |
| 1996 | alc880_uniwill_hp_automute(codec); |
| 1997 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1998 | } |
| 1999 | |
| 2000 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2001 | unsigned int res) |
| 2002 | { |
| 2003 | /* Looks like the unsol event is incompatible with the standard |
| 2004 | * definition. 4bit tag is placed at 28 bit! |
| 2005 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2006 | switch (res >> 28) { |
| 2007 | case ALC880_HP_EVENT: |
| 2008 | alc880_uniwill_hp_automute(codec); |
| 2009 | break; |
| 2010 | case ALC880_MIC_EVENT: |
| 2011 | alc880_uniwill_mic_automute(codec); |
| 2012 | break; |
| 2013 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2014 | } |
| 2015 | |
| 2016 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 2017 | { |
| 2018 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2019 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2020 | |
| 2021 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2022 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2023 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 2024 | 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] | 2025 | } |
| 2026 | |
| 2027 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2028 | { |
| 2029 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2030 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2031 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2032 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2033 | present &= HDA_AMP_VOLMASK; |
| 2034 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2035 | HDA_AMP_VOLMASK, present); |
| 2036 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2037 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2038 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2039 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2040 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2041 | unsigned int res) |
| 2042 | { |
| 2043 | /* Looks like the unsol event is incompatible with the standard |
| 2044 | * definition. 4bit tag is placed at 28 bit! |
| 2045 | */ |
| 2046 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2047 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2048 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2049 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2050 | } |
| 2051 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2052 | /* |
| 2053 | * F1734 pin configuration: |
| 2054 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2055 | */ |
| 2056 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2057 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2058 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2059 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2060 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2061 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2062 | |
| 2063 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2064 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2065 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2066 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2067 | |
| 2068 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2069 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2070 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2071 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2072 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2073 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2074 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2075 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2076 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2077 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2078 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2079 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2080 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2081 | { } |
| 2082 | }; |
| 2083 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2084 | /* |
| 2085 | * ASUS pin configuration: |
| 2086 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2087 | */ |
| 2088 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2089 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2090 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2091 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2092 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2093 | |
| 2094 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2095 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2096 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2097 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2098 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2099 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2100 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2101 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2102 | |
| 2103 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2104 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2105 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2106 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2107 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2108 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2109 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2110 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2111 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2112 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2113 | { } |
| 2114 | }; |
| 2115 | |
| 2116 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2117 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2118 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2119 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2120 | /* Clevo m520g init */ |
| 2121 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2122 | /* headphone output */ |
| 2123 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2124 | /* line-out */ |
| 2125 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2126 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2127 | /* Line-in */ |
| 2128 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2129 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2130 | /* CD */ |
| 2131 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2132 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2133 | /* Mic1 (rear panel) */ |
| 2134 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2135 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2136 | /* Mic2 (front panel) */ |
| 2137 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2138 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2139 | /* headphone */ |
| 2140 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2141 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2142 | /* change to EAPD mode */ |
| 2143 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2144 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2145 | |
| 2146 | { } |
| 2147 | }; |
| 2148 | |
| 2149 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2150 | /* change to EAPD mode */ |
| 2151 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2152 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2153 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2154 | /* Headphone output */ |
| 2155 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2156 | /* Front output*/ |
| 2157 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2158 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2159 | |
| 2160 | /* Line In pin widget for input */ |
| 2161 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2162 | /* CD pin widget for input */ |
| 2163 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2164 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2165 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2166 | |
| 2167 | /* change to EAPD mode */ |
| 2168 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2169 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2170 | |
| 2171 | { } |
| 2172 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2173 | |
| 2174 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2175 | * LG m1 express dual |
| 2176 | * |
| 2177 | * Pin assignment: |
| 2178 | * Rear Line-In/Out (blue): 0x14 |
| 2179 | * Build-in Mic-In: 0x15 |
| 2180 | * Speaker-out: 0x17 |
| 2181 | * HP-Out (green): 0x1b |
| 2182 | * Mic-In/Out (red): 0x19 |
| 2183 | * SPDIF-Out: 0x1e |
| 2184 | */ |
| 2185 | |
| 2186 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2187 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2188 | 0x05, 0x02, 0x03 |
| 2189 | }; |
| 2190 | |
| 2191 | /* seems analog CD is not working */ |
| 2192 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2193 | .num_items = 3, |
| 2194 | .items = { |
| 2195 | { "Mic", 0x1 }, |
| 2196 | { "Line", 0x5 }, |
| 2197 | { "Internal Mic", 0x6 }, |
| 2198 | }, |
| 2199 | }; |
| 2200 | |
| 2201 | /* 2,4,6 channel modes */ |
| 2202 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2203 | /* set line-in and mic-in to input */ |
| 2204 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2205 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2206 | { } |
| 2207 | }; |
| 2208 | |
| 2209 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2210 | /* set line-in to out and mic-in to input */ |
| 2211 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2212 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2213 | { } |
| 2214 | }; |
| 2215 | |
| 2216 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2217 | /* set line-in and mic-in to output */ |
| 2218 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2219 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2220 | { } |
| 2221 | }; |
| 2222 | |
| 2223 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2224 | { 2, alc880_lg_ch2_init }, |
| 2225 | { 4, alc880_lg_ch4_init }, |
| 2226 | { 6, alc880_lg_ch6_init }, |
| 2227 | }; |
| 2228 | |
| 2229 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2230 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2231 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2232 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2233 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2234 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2235 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2236 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2237 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2238 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2239 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2240 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2241 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2242 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2243 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2244 | { |
| 2245 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2246 | .name = "Channel Mode", |
| 2247 | .info = alc_ch_mode_info, |
| 2248 | .get = alc_ch_mode_get, |
| 2249 | .put = alc_ch_mode_put, |
| 2250 | }, |
| 2251 | { } /* end */ |
| 2252 | }; |
| 2253 | |
| 2254 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2255 | /* set capture source to mic-in */ |
| 2256 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2257 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2258 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2259 | /* mute all amp mixer inputs */ |
| 2260 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2261 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2262 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2263 | /* line-in to input */ |
| 2264 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2265 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2266 | /* built-in mic */ |
| 2267 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2268 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2269 | /* speaker-out */ |
| 2270 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2271 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2272 | /* mic-in to input */ |
| 2273 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2274 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2275 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2276 | /* HP-out */ |
| 2277 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2278 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2279 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2280 | /* jack sense */ |
| 2281 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2282 | { } |
| 2283 | }; |
| 2284 | |
| 2285 | /* toggle speaker-output according to the hp-jack state */ |
| 2286 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2287 | { |
| 2288 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2289 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2290 | |
| 2291 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2292 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2293 | bits = present ? HDA_AMP_MUTE : 0; |
| 2294 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2295 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2296 | } |
| 2297 | |
| 2298 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2299 | { |
| 2300 | /* Looks like the unsol event is incompatible with the standard |
| 2301 | * definition. 4bit tag is placed at 28 bit! |
| 2302 | */ |
| 2303 | if ((res >> 28) == 0x01) |
| 2304 | alc880_lg_automute(codec); |
| 2305 | } |
| 2306 | |
| 2307 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2308 | * LG LW20 |
| 2309 | * |
| 2310 | * Pin assignment: |
| 2311 | * Speaker-out: 0x14 |
| 2312 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2313 | * Built-in Mic-In: 0x19 |
| 2314 | * Line-In: 0x1b |
| 2315 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2316 | * SPDIF-Out: 0x1e |
| 2317 | */ |
| 2318 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2319 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2320 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2321 | .items = { |
| 2322 | { "Mic", 0x0 }, |
| 2323 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2324 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2325 | }, |
| 2326 | }; |
| 2327 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2328 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2329 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2330 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2331 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2332 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2333 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2334 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2335 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2336 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2337 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2338 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2339 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2340 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2341 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2342 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2343 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2344 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2345 | { |
| 2346 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2347 | .name = "Channel Mode", |
| 2348 | .info = alc_ch_mode_info, |
| 2349 | .get = alc_ch_mode_get, |
| 2350 | .put = alc_ch_mode_put, |
| 2351 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2352 | { } /* end */ |
| 2353 | }; |
| 2354 | |
| 2355 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2356 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2357 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2358 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2359 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2360 | /* set capture source to mic-in */ |
| 2361 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2362 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2363 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2364 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2365 | /* speaker-out */ |
| 2366 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2367 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2368 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2369 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2370 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2371 | /* mic-in to input */ |
| 2372 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2373 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2374 | /* built-in mic */ |
| 2375 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2376 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2377 | /* jack sense */ |
| 2378 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2379 | { } |
| 2380 | }; |
| 2381 | |
| 2382 | /* toggle speaker-output according to the hp-jack state */ |
| 2383 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2384 | { |
| 2385 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2386 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2387 | |
| 2388 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2389 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2390 | bits = present ? HDA_AMP_MUTE : 0; |
| 2391 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2392 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2393 | } |
| 2394 | |
| 2395 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2396 | { |
| 2397 | /* Looks like the unsol event is incompatible with the standard |
| 2398 | * definition. 4bit tag is placed at 28 bit! |
| 2399 | */ |
| 2400 | if ((res >> 28) == 0x01) |
| 2401 | alc880_lg_lw_automute(codec); |
| 2402 | } |
| 2403 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2404 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2405 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2406 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2407 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2408 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2409 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2410 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2411 | { } /* end */ |
| 2412 | }; |
| 2413 | |
| 2414 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2415 | .num_items = 2, |
| 2416 | .items = { |
| 2417 | { "Mic", 0x0 }, |
| 2418 | { "Internal Mic", 0x1 }, |
| 2419 | }, |
| 2420 | }; |
| 2421 | |
| 2422 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2423 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2424 | |
| 2425 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2426 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2427 | |
| 2428 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2429 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2430 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2431 | /* Mic2 (as headphone out) for HP output */ |
| 2432 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2433 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2434 | /* Internal Speaker */ |
| 2435 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2436 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2437 | |
| 2438 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2439 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2440 | |
| 2441 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2442 | { } |
| 2443 | }; |
| 2444 | |
| 2445 | /* toggle speaker-output according to the hp-jack state */ |
| 2446 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2447 | { |
| 2448 | unsigned int present; |
| 2449 | unsigned char bits; |
| 2450 | |
| 2451 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2452 | AC_VERB_GET_PIN_SENSE, 0) |
| 2453 | & AC_PINSENSE_PRESENCE; |
| 2454 | bits = present ? HDA_AMP_MUTE : 0; |
| 2455 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2456 | HDA_AMP_MUTE, bits); |
| 2457 | if (present) |
| 2458 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2459 | else |
| 2460 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2461 | } |
| 2462 | |
| 2463 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2464 | unsigned int res) |
| 2465 | { |
| 2466 | /* Looks like the unsol event is incompatible with the standard |
| 2467 | * definition. 4bit tag is placed at 28 bit! |
| 2468 | */ |
| 2469 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2470 | alc880_medion_rim_automute(codec); |
| 2471 | } |
| 2472 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2473 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2474 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2475 | { 0x0b, HDA_INPUT, 0 }, |
| 2476 | { 0x0b, HDA_INPUT, 1 }, |
| 2477 | { 0x0b, HDA_INPUT, 2 }, |
| 2478 | { 0x0b, HDA_INPUT, 3 }, |
| 2479 | { 0x0b, HDA_INPUT, 4 }, |
| 2480 | { } /* end */ |
| 2481 | }; |
| 2482 | |
| 2483 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2484 | { 0x0b, HDA_INPUT, 1 }, |
| 2485 | { 0x0b, HDA_INPUT, 6 }, |
| 2486 | { 0x0b, HDA_INPUT, 7 }, |
| 2487 | { } /* end */ |
| 2488 | }; |
| 2489 | #endif |
| 2490 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2491 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2492 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2493 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2494 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2495 | static int alc_init(struct hda_codec *codec) |
| 2496 | { |
| 2497 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2498 | unsigned int i; |
| 2499 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2500 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2501 | if (codec->vendor_id == 0x10ec0888) |
| 2502 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2503 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2504 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2505 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2506 | |
| 2507 | if (spec->init_hook) |
| 2508 | spec->init_hook(codec); |
| 2509 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2510 | return 0; |
| 2511 | } |
| 2512 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2513 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2514 | { |
| 2515 | struct alc_spec *spec = codec->spec; |
| 2516 | |
| 2517 | if (spec->unsol_event) |
| 2518 | spec->unsol_event(codec, res); |
| 2519 | } |
| 2520 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2521 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2522 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2523 | { |
| 2524 | struct alc_spec *spec = codec->spec; |
| 2525 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2526 | } |
| 2527 | #endif |
| 2528 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2529 | /* |
| 2530 | * Analog playback callbacks |
| 2531 | */ |
| 2532 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2533 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2534 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2535 | { |
| 2536 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2537 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2538 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2539 | } |
| 2540 | |
| 2541 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2542 | struct hda_codec *codec, |
| 2543 | unsigned int stream_tag, |
| 2544 | unsigned int format, |
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; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2548 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2549 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2550 | } |
| 2551 | |
| 2552 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2553 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2554 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2555 | { |
| 2556 | struct alc_spec *spec = codec->spec; |
| 2557 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2558 | } |
| 2559 | |
| 2560 | /* |
| 2561 | * Digital out |
| 2562 | */ |
| 2563 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2564 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2565 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2566 | { |
| 2567 | struct alc_spec *spec = codec->spec; |
| 2568 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2569 | } |
| 2570 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2571 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2572 | struct hda_codec *codec, |
| 2573 | unsigned int stream_tag, |
| 2574 | unsigned int format, |
| 2575 | struct snd_pcm_substream *substream) |
| 2576 | { |
| 2577 | struct alc_spec *spec = codec->spec; |
| 2578 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2579 | stream_tag, format, substream); |
| 2580 | } |
| 2581 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2582 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2583 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2584 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2585 | { |
| 2586 | struct alc_spec *spec = codec->spec; |
| 2587 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2588 | } |
| 2589 | |
| 2590 | /* |
| 2591 | * Analog capture |
| 2592 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2593 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2594 | struct hda_codec *codec, |
| 2595 | unsigned int stream_tag, |
| 2596 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2597 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2598 | { |
| 2599 | struct alc_spec *spec = codec->spec; |
| 2600 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2601 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2602 | stream_tag, 0, format); |
| 2603 | return 0; |
| 2604 | } |
| 2605 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2606 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2607 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2608 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2609 | { |
| 2610 | struct alc_spec *spec = codec->spec; |
| 2611 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2612 | snd_hda_codec_cleanup_stream(codec, |
| 2613 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2614 | return 0; |
| 2615 | } |
| 2616 | |
| 2617 | |
| 2618 | /* |
| 2619 | */ |
| 2620 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2621 | .substreams = 1, |
| 2622 | .channels_min = 2, |
| 2623 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2624 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2625 | .ops = { |
| 2626 | .open = alc880_playback_pcm_open, |
| 2627 | .prepare = alc880_playback_pcm_prepare, |
| 2628 | .cleanup = alc880_playback_pcm_cleanup |
| 2629 | }, |
| 2630 | }; |
| 2631 | |
| 2632 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2633 | .substreams = 1, |
| 2634 | .channels_min = 2, |
| 2635 | .channels_max = 2, |
| 2636 | /* NID is set in alc_build_pcms */ |
| 2637 | }; |
| 2638 | |
| 2639 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2640 | .substreams = 1, |
| 2641 | .channels_min = 2, |
| 2642 | .channels_max = 2, |
| 2643 | /* NID is set in alc_build_pcms */ |
| 2644 | }; |
| 2645 | |
| 2646 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2647 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2648 | .channels_min = 2, |
| 2649 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2650 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2651 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2652 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2653 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2654 | }, |
| 2655 | }; |
| 2656 | |
| 2657 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2658 | .substreams = 1, |
| 2659 | .channels_min = 2, |
| 2660 | .channels_max = 2, |
| 2661 | /* NID is set in alc_build_pcms */ |
| 2662 | .ops = { |
| 2663 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2664 | .close = alc880_dig_playback_pcm_close, |
| 2665 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2666 | }, |
| 2667 | }; |
| 2668 | |
| 2669 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2670 | .substreams = 1, |
| 2671 | .channels_min = 2, |
| 2672 | .channels_max = 2, |
| 2673 | /* NID is set in alc_build_pcms */ |
| 2674 | }; |
| 2675 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2676 | /* 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] | 2677 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2678 | .substreams = 0, |
| 2679 | .channels_min = 0, |
| 2680 | .channels_max = 0, |
| 2681 | }; |
| 2682 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2683 | static int alc_build_pcms(struct hda_codec *codec) |
| 2684 | { |
| 2685 | struct alc_spec *spec = codec->spec; |
| 2686 | struct hda_pcm *info = spec->pcm_rec; |
| 2687 | int i; |
| 2688 | |
| 2689 | codec->num_pcms = 1; |
| 2690 | codec->pcm_info = info; |
| 2691 | |
| 2692 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2693 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2694 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 2695 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2696 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2697 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2698 | } |
| 2699 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2700 | if (snd_BUG_ON(!spec->adc_nids)) |
| 2701 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2702 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2703 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2704 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2705 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2706 | if (spec->channel_mode) { |
| 2707 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2708 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2709 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2710 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2711 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2712 | } |
| 2713 | } |
| 2714 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2715 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2716 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2717 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2718 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2719 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2720 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2721 | if (spec->multiout.dig_out_nid && |
| 2722 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2723 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2724 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2725 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2726 | if (spec->dig_in_nid && |
| 2727 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2728 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2729 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2730 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 2731 | /* FIXME: do we need this for all Realtek codec models? */ |
| 2732 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2733 | } |
| 2734 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2735 | /* If the use of more than one ADC is requested for the current |
| 2736 | * model, configure a second analog capture-only PCM. |
| 2737 | */ |
| 2738 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2739 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2740 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2741 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2742 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2743 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2744 | if (spec->alt_dac_nid) { |
| 2745 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2746 | *spec->stream_analog_alt_playback; |
| 2747 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2748 | spec->alt_dac_nid; |
| 2749 | } else { |
| 2750 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2751 | alc_pcm_null_stream; |
| 2752 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2753 | } |
| 2754 | if (spec->num_adc_nids > 1) { |
| 2755 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2756 | *spec->stream_analog_alt_capture; |
| 2757 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2758 | spec->adc_nids[1]; |
| 2759 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2760 | spec->num_adc_nids - 1; |
| 2761 | } else { |
| 2762 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2763 | alc_pcm_null_stream; |
| 2764 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2765 | } |
| 2766 | } |
| 2767 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2768 | return 0; |
| 2769 | } |
| 2770 | |
| 2771 | static void alc_free(struct hda_codec *codec) |
| 2772 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2773 | struct alc_spec *spec = codec->spec; |
| 2774 | unsigned int i; |
| 2775 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2776 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2777 | return; |
| 2778 | |
| 2779 | if (spec->kctl_alloc) { |
| 2780 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2781 | kfree(spec->kctl_alloc[i].name); |
| 2782 | kfree(spec->kctl_alloc); |
| 2783 | } |
| 2784 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2785 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2786 | } |
| 2787 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame^] | 2788 | #ifdef SND_HDA_NEEDS_RESUME |
| 2789 | static void store_pin_configs(struct hda_codec *codec) |
| 2790 | { |
| 2791 | struct alc_spec *spec = codec->spec; |
| 2792 | hda_nid_t nid, end_nid; |
| 2793 | |
| 2794 | end_nid = codec->start_nid + codec->num_nodes; |
| 2795 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
| 2796 | unsigned int wid_caps = get_wcaps(codec, nid); |
| 2797 | unsigned int wid_type = |
| 2798 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 2799 | if (wid_type != AC_WID_PIN) |
| 2800 | continue; |
| 2801 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) |
| 2802 | break; |
| 2803 | spec->pin_nids[spec->num_pins] = nid; |
| 2804 | spec->pin_cfgs[spec->num_pins] = |
| 2805 | snd_hda_codec_read(codec, nid, 0, |
| 2806 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 2807 | spec->num_pins++; |
| 2808 | } |
| 2809 | } |
| 2810 | |
| 2811 | static void resume_pin_configs(struct hda_codec *codec) |
| 2812 | { |
| 2813 | struct alc_spec *spec = codec->spec; |
| 2814 | int i; |
| 2815 | |
| 2816 | for (i = 0; i < spec->num_pins; i++) { |
| 2817 | hda_nid_t pin_nid = spec->pin_nids[i]; |
| 2818 | unsigned int pin_config = spec->pin_cfgs[i]; |
| 2819 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2820 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 2821 | pin_config & 0x000000ff); |
| 2822 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2823 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 2824 | (pin_config & 0x0000ff00) >> 8); |
| 2825 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2826 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 2827 | (pin_config & 0x00ff0000) >> 16); |
| 2828 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2829 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 2830 | pin_config >> 24); |
| 2831 | } |
| 2832 | } |
| 2833 | |
| 2834 | static int alc_resume(struct hda_codec *codec) |
| 2835 | { |
| 2836 | resume_pin_configs(codec); |
| 2837 | codec->patch_ops.init(codec); |
| 2838 | snd_hda_codec_resume_amp(codec); |
| 2839 | snd_hda_codec_resume_cache(codec); |
| 2840 | return 0; |
| 2841 | } |
| 2842 | #else |
| 2843 | #define store_pin_configs(codec) |
| 2844 | #endif |
| 2845 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2846 | /* |
| 2847 | */ |
| 2848 | static struct hda_codec_ops alc_patch_ops = { |
| 2849 | .build_controls = alc_build_controls, |
| 2850 | .build_pcms = alc_build_pcms, |
| 2851 | .init = alc_init, |
| 2852 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2853 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame^] | 2854 | #ifdef SND_HDA_NEEDS_RESUME |
| 2855 | .resume = alc_resume, |
| 2856 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2857 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2858 | .check_power_status = alc_check_power_status, |
| 2859 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2860 | }; |
| 2861 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2862 | |
| 2863 | /* |
| 2864 | * Test configuration for debugging |
| 2865 | * |
| 2866 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2867 | * enum controls. |
| 2868 | */ |
| 2869 | #ifdef CONFIG_SND_DEBUG |
| 2870 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2871 | 0x02, 0x03, 0x04, 0x05 |
| 2872 | }; |
| 2873 | |
| 2874 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2875 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2876 | .items = { |
| 2877 | { "In-1", 0x0 }, |
| 2878 | { "In-2", 0x1 }, |
| 2879 | { "In-3", 0x2 }, |
| 2880 | { "In-4", 0x3 }, |
| 2881 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2882 | { "Front", 0x5 }, |
| 2883 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2884 | }, |
| 2885 | }; |
| 2886 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2887 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2888 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2889 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2890 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2891 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2892 | }; |
| 2893 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2894 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2895 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2896 | { |
| 2897 | static char *texts[] = { |
| 2898 | "N/A", "Line Out", "HP Out", |
| 2899 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2900 | }; |
| 2901 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2902 | uinfo->count = 1; |
| 2903 | uinfo->value.enumerated.items = 8; |
| 2904 | if (uinfo->value.enumerated.item >= 8) |
| 2905 | uinfo->value.enumerated.item = 7; |
| 2906 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2907 | return 0; |
| 2908 | } |
| 2909 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2910 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2911 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2912 | { |
| 2913 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2914 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2915 | unsigned int pin_ctl, item = 0; |
| 2916 | |
| 2917 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2918 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2919 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2920 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2921 | item = 2; |
| 2922 | else |
| 2923 | item = 1; |
| 2924 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2925 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2926 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2927 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2928 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2929 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2930 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2931 | } |
| 2932 | } |
| 2933 | ucontrol->value.enumerated.item[0] = item; |
| 2934 | return 0; |
| 2935 | } |
| 2936 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2937 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2938 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2939 | { |
| 2940 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2941 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2942 | static unsigned int ctls[] = { |
| 2943 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2944 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2945 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2946 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2947 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2948 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2949 | }; |
| 2950 | unsigned int old_ctl, new_ctl; |
| 2951 | |
| 2952 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2953 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2954 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2955 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2956 | int val; |
| 2957 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2958 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2959 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2960 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2961 | HDA_AMP_MUTE : 0; |
| 2962 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2963 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2964 | return 1; |
| 2965 | } |
| 2966 | return 0; |
| 2967 | } |
| 2968 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2969 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2970 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2971 | { |
| 2972 | static char *texts[] = { |
| 2973 | "Front", "Surround", "CLFE", "Side" |
| 2974 | }; |
| 2975 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2976 | uinfo->count = 1; |
| 2977 | uinfo->value.enumerated.items = 4; |
| 2978 | if (uinfo->value.enumerated.item >= 4) |
| 2979 | uinfo->value.enumerated.item = 3; |
| 2980 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2981 | return 0; |
| 2982 | } |
| 2983 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2984 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2985 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2986 | { |
| 2987 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2988 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2989 | unsigned int sel; |
| 2990 | |
| 2991 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2992 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2993 | return 0; |
| 2994 | } |
| 2995 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2996 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2997 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2998 | { |
| 2999 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3000 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3001 | unsigned int sel; |
| 3002 | |
| 3003 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3004 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3005 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3006 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3007 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3008 | return 1; |
| 3009 | } |
| 3010 | return 0; |
| 3011 | } |
| 3012 | |
| 3013 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3014 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3015 | .name = xname, \ |
| 3016 | .info = alc_test_pin_ctl_info, \ |
| 3017 | .get = alc_test_pin_ctl_get, \ |
| 3018 | .put = alc_test_pin_ctl_put, \ |
| 3019 | .private_value = nid \ |
| 3020 | } |
| 3021 | |
| 3022 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3023 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3024 | .name = xname, \ |
| 3025 | .info = alc_test_pin_src_info, \ |
| 3026 | .get = alc_test_pin_src_get, \ |
| 3027 | .put = alc_test_pin_src_put, \ |
| 3028 | .private_value = nid \ |
| 3029 | } |
| 3030 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3031 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3032 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3033 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3034 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3035 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3036 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3037 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3038 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3039 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3040 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3041 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3042 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3043 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3044 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3045 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3046 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3047 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3048 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3049 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3050 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3051 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3052 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3053 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3054 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3055 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3056 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3057 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3058 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3059 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3060 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3061 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3062 | { |
| 3063 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3064 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3065 | .info = alc_ch_mode_info, |
| 3066 | .get = alc_ch_mode_get, |
| 3067 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3068 | }, |
| 3069 | { } /* end */ |
| 3070 | }; |
| 3071 | |
| 3072 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3073 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3074 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3075 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3076 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3077 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3078 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3079 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3080 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3081 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3082 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3083 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3084 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3085 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3086 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3087 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3088 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3089 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3090 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3091 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3092 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3093 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3094 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3095 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3096 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3097 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3098 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3099 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3100 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3101 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3102 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3103 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3104 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3105 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3106 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3107 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3108 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3109 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3110 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3111 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3112 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3113 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3114 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3115 | /* Analog input/passthru */ |
| 3116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3118 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3119 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3120 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3121 | { } |
| 3122 | }; |
| 3123 | #endif |
| 3124 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3125 | /* |
| 3126 | */ |
| 3127 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3128 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3129 | [ALC880_3ST] = "3stack", |
| 3130 | [ALC880_TCL_S700] = "tcl", |
| 3131 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3132 | [ALC880_CLEVO] = "clevo", |
| 3133 | [ALC880_5ST] = "5stack", |
| 3134 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3135 | [ALC880_W810] = "w810", |
| 3136 | [ALC880_Z71V] = "z71v", |
| 3137 | [ALC880_6ST] = "6stack", |
| 3138 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3139 | [ALC880_ASUS] = "asus", |
| 3140 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3141 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3142 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3143 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3144 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3145 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3146 | [ALC880_F1734] = "F1734", |
| 3147 | [ALC880_LG] = "lg", |
| 3148 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3149 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3150 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3151 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3152 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3153 | [ALC880_AUTO] = "auto", |
| 3154 | }; |
| 3155 | |
| 3156 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3157 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3158 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3159 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3160 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3161 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3162 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3163 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3164 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3165 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3166 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3167 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3168 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3169 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3170 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3171 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3172 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3173 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3174 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3175 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3176 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3177 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3178 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3179 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3180 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3181 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3182 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3183 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3184 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3185 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3186 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3187 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3188 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3189 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3190 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3191 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3192 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3193 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3194 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3195 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3196 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3197 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3198 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3199 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3200 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3201 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3202 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3203 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3204 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3205 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3206 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3207 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3208 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3209 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3210 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3211 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3212 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3213 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3214 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3215 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3216 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3217 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3218 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3219 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3220 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3221 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3222 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3223 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3224 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3225 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3226 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3227 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3228 | {} |
| 3229 | }; |
| 3230 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3231 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3232 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3233 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3234 | static struct alc_config_preset alc880_presets[] = { |
| 3235 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3236 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3237 | .init_verbs = { alc880_volume_init_verbs, |
| 3238 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3239 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3240 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3241 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3242 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3243 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3244 | .input_mux = &alc880_capture_source, |
| 3245 | }, |
| 3246 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3247 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3248 | .init_verbs = { alc880_volume_init_verbs, |
| 3249 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3250 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3251 | .dac_nids = alc880_dac_nids, |
| 3252 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3253 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3254 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3255 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3256 | .input_mux = &alc880_capture_source, |
| 3257 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3258 | [ALC880_TCL_S700] = { |
| 3259 | .mixers = { alc880_tcl_s700_mixer }, |
| 3260 | .init_verbs = { alc880_volume_init_verbs, |
| 3261 | alc880_pin_tcl_S700_init_verbs, |
| 3262 | alc880_gpio2_init_verbs }, |
| 3263 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3264 | .dac_nids = alc880_dac_nids, |
| 3265 | .hp_nid = 0x03, |
| 3266 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3267 | .channel_mode = alc880_2_jack_modes, |
| 3268 | .input_mux = &alc880_capture_source, |
| 3269 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3270 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3271 | .mixers = { alc880_three_stack_mixer, |
| 3272 | alc880_five_stack_mixer}, |
| 3273 | .init_verbs = { alc880_volume_init_verbs, |
| 3274 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3275 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3276 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3277 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3278 | .channel_mode = alc880_fivestack_modes, |
| 3279 | .input_mux = &alc880_capture_source, |
| 3280 | }, |
| 3281 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3282 | .mixers = { alc880_three_stack_mixer, |
| 3283 | alc880_five_stack_mixer }, |
| 3284 | .init_verbs = { alc880_volume_init_verbs, |
| 3285 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3286 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3287 | .dac_nids = alc880_dac_nids, |
| 3288 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3289 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3290 | .channel_mode = alc880_fivestack_modes, |
| 3291 | .input_mux = &alc880_capture_source, |
| 3292 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3293 | [ALC880_6ST] = { |
| 3294 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3295 | .init_verbs = { alc880_volume_init_verbs, |
| 3296 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3297 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3298 | .dac_nids = alc880_6st_dac_nids, |
| 3299 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3300 | .channel_mode = alc880_sixstack_modes, |
| 3301 | .input_mux = &alc880_6stack_capture_source, |
| 3302 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3303 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3304 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3305 | .init_verbs = { alc880_volume_init_verbs, |
| 3306 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3307 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3308 | .dac_nids = alc880_6st_dac_nids, |
| 3309 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3310 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3311 | .channel_mode = alc880_sixstack_modes, |
| 3312 | .input_mux = &alc880_6stack_capture_source, |
| 3313 | }, |
| 3314 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3315 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3316 | .init_verbs = { alc880_volume_init_verbs, |
| 3317 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3318 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3319 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3320 | .dac_nids = alc880_w810_dac_nids, |
| 3321 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3322 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3323 | .channel_mode = alc880_w810_modes, |
| 3324 | .input_mux = &alc880_capture_source, |
| 3325 | }, |
| 3326 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3327 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3328 | .init_verbs = { alc880_volume_init_verbs, |
| 3329 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3330 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3331 | .dac_nids = alc880_z71v_dac_nids, |
| 3332 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3333 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3334 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3335 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3336 | .input_mux = &alc880_capture_source, |
| 3337 | }, |
| 3338 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3339 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3340 | .init_verbs = { alc880_volume_init_verbs, |
| 3341 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3342 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3343 | .dac_nids = alc880_f1734_dac_nids, |
| 3344 | .hp_nid = 0x02, |
| 3345 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3346 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3347 | .input_mux = &alc880_f1734_capture_source, |
| 3348 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3349 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3350 | }, |
| 3351 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3352 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3353 | .init_verbs = { alc880_volume_init_verbs, |
| 3354 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3355 | alc880_gpio1_init_verbs }, |
| 3356 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3357 | .dac_nids = alc880_asus_dac_nids, |
| 3358 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3359 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3360 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3361 | .input_mux = &alc880_capture_source, |
| 3362 | }, |
| 3363 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3364 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3365 | .init_verbs = { alc880_volume_init_verbs, |
| 3366 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3367 | alc880_gpio1_init_verbs }, |
| 3368 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3369 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3370 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3371 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3372 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3373 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3374 | .input_mux = &alc880_capture_source, |
| 3375 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3376 | [ALC880_ASUS_DIG2] = { |
| 3377 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3378 | .init_verbs = { alc880_volume_init_verbs, |
| 3379 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3380 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3381 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3382 | .dac_nids = alc880_asus_dac_nids, |
| 3383 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3384 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3385 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3386 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3387 | .input_mux = &alc880_capture_source, |
| 3388 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3389 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3390 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3391 | .init_verbs = { alc880_volume_init_verbs, |
| 3392 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3393 | alc880_gpio1_init_verbs }, |
| 3394 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3395 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3396 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3397 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3398 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3399 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3400 | .input_mux = &alc880_capture_source, |
| 3401 | }, |
| 3402 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3403 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3404 | .init_verbs = { alc880_volume_init_verbs, |
| 3405 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3406 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3407 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3408 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3409 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3410 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3411 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3412 | .input_mux = &alc880_capture_source, |
| 3413 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3414 | [ALC880_UNIWILL] = { |
| 3415 | .mixers = { alc880_uniwill_mixer }, |
| 3416 | .init_verbs = { alc880_volume_init_verbs, |
| 3417 | alc880_uniwill_init_verbs }, |
| 3418 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3419 | .dac_nids = alc880_asus_dac_nids, |
| 3420 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3421 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3422 | .channel_mode = alc880_threestack_modes, |
| 3423 | .need_dac_fix = 1, |
| 3424 | .input_mux = &alc880_capture_source, |
| 3425 | .unsol_event = alc880_uniwill_unsol_event, |
| 3426 | .init_hook = alc880_uniwill_automute, |
| 3427 | }, |
| 3428 | [ALC880_UNIWILL_P53] = { |
| 3429 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3430 | .init_verbs = { alc880_volume_init_verbs, |
| 3431 | alc880_uniwill_p53_init_verbs }, |
| 3432 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3433 | .dac_nids = alc880_asus_dac_nids, |
| 3434 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3435 | .channel_mode = alc880_threestack_modes, |
| 3436 | .input_mux = &alc880_capture_source, |
| 3437 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3438 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3439 | }, |
| 3440 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3441 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3442 | alc880_pcbeep_mixer, }, |
| 3443 | .init_verbs = { alc880_volume_init_verbs, |
| 3444 | alc880_uniwill_p53_init_verbs, |
| 3445 | alc880_beep_init_verbs }, |
| 3446 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3447 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3448 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3449 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3450 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3451 | .input_mux = &alc880_capture_source, |
| 3452 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3453 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3454 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3455 | [ALC880_CLEVO] = { |
| 3456 | .mixers = { alc880_three_stack_mixer }, |
| 3457 | .init_verbs = { alc880_volume_init_verbs, |
| 3458 | alc880_pin_clevo_init_verbs }, |
| 3459 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3460 | .dac_nids = alc880_dac_nids, |
| 3461 | .hp_nid = 0x03, |
| 3462 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3463 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3464 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3465 | .input_mux = &alc880_capture_source, |
| 3466 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3467 | [ALC880_LG] = { |
| 3468 | .mixers = { alc880_lg_mixer }, |
| 3469 | .init_verbs = { alc880_volume_init_verbs, |
| 3470 | alc880_lg_init_verbs }, |
| 3471 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3472 | .dac_nids = alc880_lg_dac_nids, |
| 3473 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3474 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3475 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3476 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3477 | .input_mux = &alc880_lg_capture_source, |
| 3478 | .unsol_event = alc880_lg_unsol_event, |
| 3479 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3480 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3481 | .loopbacks = alc880_lg_loopbacks, |
| 3482 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3483 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3484 | [ALC880_LG_LW] = { |
| 3485 | .mixers = { alc880_lg_lw_mixer }, |
| 3486 | .init_verbs = { alc880_volume_init_verbs, |
| 3487 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3488 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3489 | .dac_nids = alc880_dac_nids, |
| 3490 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3491 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3492 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3493 | .input_mux = &alc880_lg_lw_capture_source, |
| 3494 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3495 | .init_hook = alc880_lg_lw_automute, |
| 3496 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3497 | [ALC880_MEDION_RIM] = { |
| 3498 | .mixers = { alc880_medion_rim_mixer }, |
| 3499 | .init_verbs = { alc880_volume_init_verbs, |
| 3500 | alc880_medion_rim_init_verbs, |
| 3501 | alc_gpio2_init_verbs }, |
| 3502 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3503 | .dac_nids = alc880_dac_nids, |
| 3504 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3505 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3506 | .channel_mode = alc880_2_jack_modes, |
| 3507 | .input_mux = &alc880_medion_rim_capture_source, |
| 3508 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3509 | .init_hook = alc880_medion_rim_automute, |
| 3510 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3511 | #ifdef CONFIG_SND_DEBUG |
| 3512 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3513 | .mixers = { alc880_test_mixer }, |
| 3514 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3515 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3516 | .dac_nids = alc880_test_dac_nids, |
| 3517 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3518 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3519 | .channel_mode = alc880_test_modes, |
| 3520 | .input_mux = &alc880_test_capture_source, |
| 3521 | }, |
| 3522 | #endif |
| 3523 | }; |
| 3524 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3525 | /* |
| 3526 | * Automatic parse of I/O pins from the BIOS configuration |
| 3527 | */ |
| 3528 | |
| 3529 | #define NUM_CONTROL_ALLOC 32 |
| 3530 | #define NUM_VERB_ALLOC 32 |
| 3531 | |
| 3532 | enum { |
| 3533 | ALC_CTL_WIDGET_VOL, |
| 3534 | ALC_CTL_WIDGET_MUTE, |
| 3535 | ALC_CTL_BIND_MUTE, |
| 3536 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3537 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3538 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3539 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3540 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3541 | }; |
| 3542 | |
| 3543 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3544 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3545 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3546 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3547 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3548 | |
| 3549 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3550 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3551 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3552 | /* array + terminator */ |
| 3553 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3554 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3555 | return -ENOMEM; |
| 3556 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3557 | memcpy(knew, spec->kctl_alloc, |
| 3558 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3559 | kfree(spec->kctl_alloc); |
| 3560 | } |
| 3561 | spec->kctl_alloc = knew; |
| 3562 | spec->num_kctl_alloc = num; |
| 3563 | } |
| 3564 | |
| 3565 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3566 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3567 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3568 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3569 | return -ENOMEM; |
| 3570 | knew->private_value = val; |
| 3571 | spec->num_kctl_used++; |
| 3572 | return 0; |
| 3573 | } |
| 3574 | |
| 3575 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3576 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3577 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3578 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3579 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3580 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3581 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3582 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3583 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3584 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3585 | #define ALC880_PIN_CD_NID 0x1c |
| 3586 | |
| 3587 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3588 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3589 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3590 | { |
| 3591 | hda_nid_t nid; |
| 3592 | int assigned[4]; |
| 3593 | int i, j; |
| 3594 | |
| 3595 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3596 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3597 | |
| 3598 | /* check the pins hardwired to audio widget */ |
| 3599 | for (i = 0; i < cfg->line_outs; i++) { |
| 3600 | nid = cfg->line_out_pins[i]; |
| 3601 | if (alc880_is_fixed_pin(nid)) { |
| 3602 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3603 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3604 | assigned[idx] = 1; |
| 3605 | } |
| 3606 | } |
| 3607 | /* left pins can be connect to any audio widget */ |
| 3608 | for (i = 0; i < cfg->line_outs; i++) { |
| 3609 | nid = cfg->line_out_pins[i]; |
| 3610 | if (alc880_is_fixed_pin(nid)) |
| 3611 | continue; |
| 3612 | /* search for an empty channel */ |
| 3613 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3614 | if (!assigned[j]) { |
| 3615 | spec->multiout.dac_nids[i] = |
| 3616 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3617 | assigned[j] = 1; |
| 3618 | break; |
| 3619 | } |
| 3620 | } |
| 3621 | } |
| 3622 | spec->multiout.num_dacs = cfg->line_outs; |
| 3623 | return 0; |
| 3624 | } |
| 3625 | |
| 3626 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3627 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3628 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3629 | { |
| 3630 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3631 | static const char *chname[4] = { |
| 3632 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3633 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3634 | hda_nid_t nid; |
| 3635 | int i, err; |
| 3636 | |
| 3637 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3638 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3639 | continue; |
| 3640 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3641 | if (i == 2) { |
| 3642 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3643 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3644 | "Center Playback Volume", |
| 3645 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3646 | HDA_OUTPUT)); |
| 3647 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3648 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3649 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3650 | "LFE Playback Volume", |
| 3651 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3652 | HDA_OUTPUT)); |
| 3653 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3654 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3655 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3656 | "Center Playback Switch", |
| 3657 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3658 | HDA_INPUT)); |
| 3659 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3660 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3661 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3662 | "LFE Playback Switch", |
| 3663 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3664 | HDA_INPUT)); |
| 3665 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3666 | return err; |
| 3667 | } else { |
| 3668 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3669 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3670 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3671 | HDA_OUTPUT)); |
| 3672 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3673 | return err; |
| 3674 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3675 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3676 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3677 | HDA_INPUT)); |
| 3678 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3679 | return err; |
| 3680 | } |
| 3681 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3682 | return 0; |
| 3683 | } |
| 3684 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3685 | /* add playback controls for speaker and HP outputs */ |
| 3686 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3687 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3688 | { |
| 3689 | hda_nid_t nid; |
| 3690 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3691 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3692 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3693 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3694 | return 0; |
| 3695 | |
| 3696 | if (alc880_is_fixed_pin(pin)) { |
| 3697 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3698 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3699 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3700 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3701 | else |
| 3702 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3703 | /* control HP volume/switch on the output mixer amp */ |
| 3704 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3705 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3706 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3707 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3708 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3709 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3710 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3711 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3712 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3713 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3714 | return err; |
| 3715 | } else if (alc880_is_multi_pin(pin)) { |
| 3716 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3717 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3718 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3719 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3720 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3721 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3722 | return err; |
| 3723 | } |
| 3724 | return 0; |
| 3725 | } |
| 3726 | |
| 3727 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3728 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3729 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3730 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3731 | { |
| 3732 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3733 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3734 | |
| 3735 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3736 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3737 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3738 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3739 | return err; |
| 3740 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3741 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3742 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3743 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3744 | return err; |
| 3745 | return 0; |
| 3746 | } |
| 3747 | |
| 3748 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3749 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3750 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3751 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3752 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3753 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3754 | |
| 3755 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3756 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3757 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3758 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3759 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3760 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3761 | if (err < 0) |
| 3762 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3763 | imux->items[imux->num_items].label = |
| 3764 | auto_pin_cfg_labels[i]; |
| 3765 | imux->items[imux->num_items].index = |
| 3766 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3767 | imux->num_items++; |
| 3768 | } |
| 3769 | } |
| 3770 | return 0; |
| 3771 | } |
| 3772 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3773 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3774 | unsigned int pin_type) |
| 3775 | { |
| 3776 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3777 | pin_type); |
| 3778 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3779 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3780 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3781 | } |
| 3782 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3783 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3784 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3785 | int dac_idx) |
| 3786 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3787 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3788 | /* need the manual connection? */ |
| 3789 | if (alc880_is_multi_pin(nid)) { |
| 3790 | struct alc_spec *spec = codec->spec; |
| 3791 | int idx = alc880_multi_pin_idx(nid); |
| 3792 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3793 | AC_VERB_SET_CONNECT_SEL, |
| 3794 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3795 | } |
| 3796 | } |
| 3797 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3798 | static int get_pin_type(int line_out_type) |
| 3799 | { |
| 3800 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3801 | return PIN_HP; |
| 3802 | else |
| 3803 | return PIN_OUT; |
| 3804 | } |
| 3805 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3806 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3807 | { |
| 3808 | struct alc_spec *spec = codec->spec; |
| 3809 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3810 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3811 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3812 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3813 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3814 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3815 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3816 | } |
| 3817 | } |
| 3818 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3819 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3820 | { |
| 3821 | struct alc_spec *spec = codec->spec; |
| 3822 | hda_nid_t pin; |
| 3823 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3824 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3825 | if (pin) /* connect to front */ |
| 3826 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3827 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3828 | if (pin) /* connect to front */ |
| 3829 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3830 | } |
| 3831 | |
| 3832 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3833 | { |
| 3834 | struct alc_spec *spec = codec->spec; |
| 3835 | int i; |
| 3836 | |
| 3837 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3838 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3839 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3840 | snd_hda_codec_write(codec, nid, 0, |
| 3841 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3842 | i <= AUTO_PIN_FRONT_MIC ? |
| 3843 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3844 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3845 | snd_hda_codec_write(codec, nid, 0, |
| 3846 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3847 | AMP_OUT_MUTE); |
| 3848 | } |
| 3849 | } |
| 3850 | } |
| 3851 | |
| 3852 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3853 | /* return 1 if successful, 0 if the proper config is not found, |
| 3854 | * or a negative error code |
| 3855 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3856 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3857 | { |
| 3858 | struct alc_spec *spec = codec->spec; |
| 3859 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3860 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3861 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3862 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3863 | alc880_ignore); |
| 3864 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3865 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3866 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3867 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3868 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3869 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3870 | if (err < 0) |
| 3871 | return err; |
| 3872 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3873 | if (err < 0) |
| 3874 | return err; |
| 3875 | err = alc880_auto_create_extra_out(spec, |
| 3876 | spec->autocfg.speaker_pins[0], |
| 3877 | "Speaker"); |
| 3878 | if (err < 0) |
| 3879 | return err; |
| 3880 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3881 | "Headphone"); |
| 3882 | if (err < 0) |
| 3883 | return err; |
| 3884 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3885 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3886 | return err; |
| 3887 | |
| 3888 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3889 | |
| 3890 | if (spec->autocfg.dig_out_pin) |
| 3891 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3892 | if (spec->autocfg.dig_in_pin) |
| 3893 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3894 | |
| 3895 | if (spec->kctl_alloc) |
| 3896 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3897 | |
| 3898 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3899 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3900 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3901 | spec->input_mux = &spec->private_imux; |
| 3902 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame^] | 3903 | store_pin_configs(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3904 | return 1; |
| 3905 | } |
| 3906 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3907 | /* additional initialization for auto-configuration model */ |
| 3908 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3909 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3910 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3911 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3912 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3913 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3914 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 3915 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3916 | } |
| 3917 | |
| 3918 | /* |
| 3919 | * OK, here we have finally the patch for ALC880 |
| 3920 | */ |
| 3921 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3922 | static int patch_alc880(struct hda_codec *codec) |
| 3923 | { |
| 3924 | struct alc_spec *spec; |
| 3925 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3926 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3927 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3928 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3929 | if (spec == NULL) |
| 3930 | return -ENOMEM; |
| 3931 | |
| 3932 | codec->spec = spec; |
| 3933 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3934 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3935 | alc880_models, |
| 3936 | alc880_cfg_tbl); |
| 3937 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3938 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3939 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3940 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3941 | } |
| 3942 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3943 | if (board_config == ALC880_AUTO) { |
| 3944 | /* automatic parse from the BIOS config */ |
| 3945 | err = alc880_parse_auto_config(codec); |
| 3946 | if (err < 0) { |
| 3947 | alc_free(codec); |
| 3948 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3949 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3950 | printk(KERN_INFO |
| 3951 | "hda_codec: Cannot set up configuration " |
| 3952 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3953 | board_config = ALC880_3ST; |
| 3954 | } |
| 3955 | } |
| 3956 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3957 | if (board_config != ALC880_AUTO) |
| 3958 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3959 | |
| 3960 | spec->stream_name_analog = "ALC880 Analog"; |
| 3961 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3962 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3963 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3964 | |
| 3965 | spec->stream_name_digital = "ALC880 Digital"; |
| 3966 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3967 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3968 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3969 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3970 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3971 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3972 | /* get type */ |
| 3973 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3974 | if (wcap != AC_WID_AUD_IN) { |
| 3975 | spec->adc_nids = alc880_adc_nids_alt; |
| 3976 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3977 | spec->mixers[spec->num_mixers] = |
| 3978 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3979 | spec->num_mixers++; |
| 3980 | } else { |
| 3981 | spec->adc_nids = alc880_adc_nids; |
| 3982 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3983 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3984 | spec->num_mixers++; |
| 3985 | } |
| 3986 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3987 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3988 | spec->vmaster_nid = 0x0c; |
| 3989 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3990 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3991 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3992 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3993 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3994 | if (!spec->loopback.amplist) |
| 3995 | spec->loopback.amplist = alc880_loopbacks; |
| 3996 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3997 | |
| 3998 | return 0; |
| 3999 | } |
| 4000 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4001 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4002 | /* |
| 4003 | * ALC260 support |
| 4004 | */ |
| 4005 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4006 | static hda_nid_t alc260_dac_nids[1] = { |
| 4007 | /* front */ |
| 4008 | 0x02, |
| 4009 | }; |
| 4010 | |
| 4011 | static hda_nid_t alc260_adc_nids[1] = { |
| 4012 | /* ADC0 */ |
| 4013 | 0x04, |
| 4014 | }; |
| 4015 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4016 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4017 | /* ADC1 */ |
| 4018 | 0x05, |
| 4019 | }; |
| 4020 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4021 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 4022 | /* ADC1, 0 */ |
| 4023 | 0x05, 0x04 |
| 4024 | }; |
| 4025 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4026 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4027 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4028 | */ |
| 4029 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4030 | /* ADC0, ADC1 */ |
| 4031 | 0x04, 0x05 |
| 4032 | }; |
| 4033 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4034 | #define ALC260_DIGOUT_NID 0x03 |
| 4035 | #define ALC260_DIGIN_NID 0x06 |
| 4036 | |
| 4037 | static struct hda_input_mux alc260_capture_source = { |
| 4038 | .num_items = 4, |
| 4039 | .items = { |
| 4040 | { "Mic", 0x0 }, |
| 4041 | { "Front Mic", 0x1 }, |
| 4042 | { "Line", 0x2 }, |
| 4043 | { "CD", 0x4 }, |
| 4044 | }, |
| 4045 | }; |
| 4046 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4047 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4048 | * headphone jack and the internal CD lines since these are the only pins at |
| 4049 | * which audio can appear. For flexibility, also allow the option of |
| 4050 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4051 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4052 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4053 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4054 | { |
| 4055 | .num_items = 3, |
| 4056 | .items = { |
| 4057 | { "Mic/Line", 0x0 }, |
| 4058 | { "CD", 0x4 }, |
| 4059 | { "Headphone", 0x2 }, |
| 4060 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4061 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4062 | { |
| 4063 | .num_items = 4, |
| 4064 | .items = { |
| 4065 | { "Mic/Line", 0x0 }, |
| 4066 | { "CD", 0x4 }, |
| 4067 | { "Headphone", 0x2 }, |
| 4068 | { "Mixer", 0x5 }, |
| 4069 | }, |
| 4070 | }, |
| 4071 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4072 | }; |
| 4073 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4074 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4075 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4076 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4077 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4078 | { |
| 4079 | .num_items = 4, |
| 4080 | .items = { |
| 4081 | { "Mic", 0x0 }, |
| 4082 | { "Line", 0x2 }, |
| 4083 | { "CD", 0x4 }, |
| 4084 | { "Headphone", 0x5 }, |
| 4085 | }, |
| 4086 | }, |
| 4087 | { |
| 4088 | .num_items = 5, |
| 4089 | .items = { |
| 4090 | { "Mic", 0x0 }, |
| 4091 | { "Line", 0x2 }, |
| 4092 | { "CD", 0x4 }, |
| 4093 | { "Headphone", 0x6 }, |
| 4094 | { "Mixer", 0x5 }, |
| 4095 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4096 | }, |
| 4097 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4098 | /* |
| 4099 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4100 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4101 | * element which allows changing the channel mode, so the verb list is |
| 4102 | * never used. |
| 4103 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4104 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4105 | { 2, NULL }, |
| 4106 | }; |
| 4107 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4108 | |
| 4109 | /* Mixer combinations |
| 4110 | * |
| 4111 | * basic: base_output + input + pc_beep + capture |
| 4112 | * HP: base_output + input + capture_alt |
| 4113 | * HP_3013: hp_3013 + input + capture |
| 4114 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4115 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4116 | */ |
| 4117 | |
| 4118 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4119 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4120 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4121 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4122 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4123 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4124 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4125 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4126 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4127 | |
| 4128 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4129 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4130 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4131 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4132 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4133 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4134 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4135 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4136 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4137 | { } /* end */ |
| 4138 | }; |
| 4139 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4140 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 4141 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4142 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4143 | { } /* end */ |
| 4144 | }; |
| 4145 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4146 | /* update HP, line and mono out pins according to the master switch */ |
| 4147 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4148 | hda_nid_t hp, hda_nid_t line, |
| 4149 | hda_nid_t mono) |
| 4150 | { |
| 4151 | struct alc_spec *spec = codec->spec; |
| 4152 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4153 | /* change HP and line-out pins */ |
| 4154 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4155 | val); |
| 4156 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4157 | val); |
| 4158 | /* mono (speaker) depending on the HP jack sense */ |
| 4159 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 4160 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4161 | val); |
| 4162 | } |
| 4163 | |
| 4164 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4165 | struct snd_ctl_elem_value *ucontrol) |
| 4166 | { |
| 4167 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4168 | struct alc_spec *spec = codec->spec; |
| 4169 | *ucontrol->value.integer.value = spec->master_sw; |
| 4170 | return 0; |
| 4171 | } |
| 4172 | |
| 4173 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4174 | struct snd_ctl_elem_value *ucontrol) |
| 4175 | { |
| 4176 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4177 | struct alc_spec *spec = codec->spec; |
| 4178 | int val = !!*ucontrol->value.integer.value; |
| 4179 | hda_nid_t hp, line, mono; |
| 4180 | |
| 4181 | if (val == spec->master_sw) |
| 4182 | return 0; |
| 4183 | spec->master_sw = val; |
| 4184 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4185 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4186 | mono = kcontrol->private_value & 0xff; |
| 4187 | alc260_hp_master_update(codec, hp, line, mono); |
| 4188 | return 1; |
| 4189 | } |
| 4190 | |
| 4191 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4192 | { |
| 4193 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4194 | .name = "Master Playback Switch", |
| 4195 | .info = snd_ctl_boolean_mono_info, |
| 4196 | .get = alc260_hp_master_sw_get, |
| 4197 | .put = alc260_hp_master_sw_put, |
| 4198 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4199 | }, |
| 4200 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4201 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4202 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4203 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4204 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4205 | HDA_OUTPUT), |
| 4206 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4207 | { } /* end */ |
| 4208 | }; |
| 4209 | |
| 4210 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4211 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4212 | {}, |
| 4213 | }; |
| 4214 | |
| 4215 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4216 | { |
| 4217 | struct alc_spec *spec = codec->spec; |
| 4218 | unsigned int present; |
| 4219 | |
| 4220 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4221 | AC_VERB_GET_PIN_SENSE, 0); |
| 4222 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4223 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4224 | } |
| 4225 | |
| 4226 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4227 | { |
| 4228 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4229 | alc260_hp_automute(codec); |
| 4230 | } |
| 4231 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4232 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4233 | { |
| 4234 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4235 | .name = "Master Playback Switch", |
| 4236 | .info = snd_ctl_boolean_mono_info, |
| 4237 | .get = alc260_hp_master_sw_get, |
| 4238 | .put = alc260_hp_master_sw_put, |
| 4239 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 4240 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4241 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4242 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4243 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4244 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4245 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4246 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4247 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4248 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4249 | { } /* end */ |
| 4250 | }; |
| 4251 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4252 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4253 | .ops = &snd_hda_bind_vol, |
| 4254 | .values = { |
| 4255 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4256 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4257 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4258 | 0 |
| 4259 | }, |
| 4260 | }; |
| 4261 | |
| 4262 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4263 | .ops = &snd_hda_bind_sw, |
| 4264 | .values = { |
| 4265 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4266 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4267 | 0 |
| 4268 | }, |
| 4269 | }; |
| 4270 | |
| 4271 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4272 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4273 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4274 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4275 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4276 | { } /* end */ |
| 4277 | }; |
| 4278 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4279 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4280 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4281 | {}, |
| 4282 | }; |
| 4283 | |
| 4284 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4285 | { |
| 4286 | struct alc_spec *spec = codec->spec; |
| 4287 | unsigned int present; |
| 4288 | |
| 4289 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4290 | AC_VERB_GET_PIN_SENSE, 0); |
| 4291 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4292 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 4293 | } |
| 4294 | |
| 4295 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4296 | unsigned int res) |
| 4297 | { |
| 4298 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4299 | alc260_hp_3013_automute(codec); |
| 4300 | } |
| 4301 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4302 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4303 | { |
| 4304 | unsigned int present, bits; |
| 4305 | |
| 4306 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4307 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4308 | |
| 4309 | bits = present ? 0 : PIN_OUT; |
| 4310 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4311 | bits); |
| 4312 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4313 | bits); |
| 4314 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4315 | bits); |
| 4316 | } |
| 4317 | |
| 4318 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4319 | unsigned int res) |
| 4320 | { |
| 4321 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4322 | alc260_hp_3012_automute(codec); |
| 4323 | } |
| 4324 | |
| 4325 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4326 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4327 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4328 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4329 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4330 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4331 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4332 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4333 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4334 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4335 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4336 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4337 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4338 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4339 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4340 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4341 | { } /* end */ |
| 4342 | }; |
| 4343 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4344 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4345 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4346 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4347 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4348 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4349 | * revisions available in early 2006. Therefore for now allow the |
| 4350 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4351 | * that the lack of mic bias for this NID is intentional we could change the |
| 4352 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4353 | * |
| 4354 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4355 | * don't appear to make the mic bias available from the "line" jack, even |
| 4356 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4357 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4358 | * and the output jack. If this turns out to be the case for all such |
| 4359 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4360 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4361 | * |
| 4362 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4363 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4364 | * controls for such models. On models without a "mono speaker" the control |
| 4365 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4366 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4367 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4368 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4369 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4370 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4371 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4372 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4373 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4374 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4375 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4376 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4377 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4378 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4379 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4380 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4381 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4382 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4383 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4384 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4385 | { } /* end */ |
| 4386 | }; |
| 4387 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4388 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4389 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4390 | */ |
| 4391 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4392 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4393 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4394 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4395 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4396 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4397 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4398 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4399 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4400 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4401 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4402 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4403 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4404 | { } /* end */ |
| 4405 | }; |
| 4406 | |
| 4407 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4408 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4409 | */ |
| 4410 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4411 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4412 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4413 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4414 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4415 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4416 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4417 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4418 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4419 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4420 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4421 | { } /* end */ |
| 4422 | }; |
| 4423 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4424 | /* capture mixer elements */ |
| 4425 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4426 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4427 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4428 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4429 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4430 | { |
| 4431 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4432 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4433 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4434 | */ |
| 4435 | /* .name = "Capture Source", */ |
| 4436 | .name = "Input Source", |
| 4437 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4438 | .info = alc_mux_enum_info, |
| 4439 | .get = alc_mux_enum_get, |
| 4440 | .put = alc_mux_enum_put, |
| 4441 | }, |
| 4442 | { } /* end */ |
| 4443 | }; |
| 4444 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4445 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4446 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4447 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4448 | { |
| 4449 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4450 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4451 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4452 | */ |
| 4453 | /* .name = "Capture Source", */ |
| 4454 | .name = "Input Source", |
| 4455 | .count = 1, |
| 4456 | .info = alc_mux_enum_info, |
| 4457 | .get = alc_mux_enum_get, |
| 4458 | .put = alc_mux_enum_put, |
| 4459 | }, |
| 4460 | { } /* end */ |
| 4461 | }; |
| 4462 | |
| 4463 | /* |
| 4464 | * initialization verbs |
| 4465 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4466 | static struct hda_verb alc260_init_verbs[] = { |
| 4467 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4468 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4469 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4470 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4471 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4472 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4473 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4474 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4475 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4476 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4477 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4478 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4479 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4480 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4481 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4482 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4483 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4484 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4485 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4486 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4487 | /* set connection select to line in (default select for this ADC) */ |
| 4488 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4489 | /* mute capture amp left and right */ |
| 4490 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4491 | /* set connection select to line in (default select for this ADC) */ |
| 4492 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4493 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4494 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4495 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4496 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4497 | /* set vol=0 HP mixer amp left and right */ |
| 4498 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4499 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4500 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4501 | /* set vol=0 Mono mixer amp left and right */ |
| 4502 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4503 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4504 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4505 | /* unmute LINE-2 out pin */ |
| 4506 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4507 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4508 | * Line In 2 = 0x03 |
| 4509 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4510 | /* mute analog inputs */ |
| 4511 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4512 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4513 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4514 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4515 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4516 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4517 | /* mute Front out path */ |
| 4518 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4519 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4520 | /* mute Headphone out path */ |
| 4521 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4522 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4523 | /* mute Mono out path */ |
| 4524 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4525 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4526 | { } |
| 4527 | }; |
| 4528 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4529 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4530 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4531 | /* Headphone and output */ |
| 4532 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4533 | /* mono output */ |
| 4534 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4535 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4536 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4537 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4538 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4539 | /* Line In pin widget for input */ |
| 4540 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4541 | /* Line-2 pin widget for output */ |
| 4542 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4543 | /* CD pin widget for input */ |
| 4544 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4545 | /* unmute amp left and right */ |
| 4546 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4547 | /* set connection select to line in (default select for this ADC) */ |
| 4548 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4549 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4550 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4551 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4552 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4553 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4554 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4555 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4556 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4557 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4558 | * Line In 2 = 0x03 |
| 4559 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4560 | /* mute analog inputs */ |
| 4561 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4562 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4563 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4564 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4565 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4566 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4567 | /* Unmute Front out path */ |
| 4568 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4569 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4570 | /* Unmute Headphone out path */ |
| 4571 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4572 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4573 | /* Unmute Mono out path */ |
| 4574 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4575 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4576 | { } |
| 4577 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4578 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4579 | |
| 4580 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4581 | /* Line out and output */ |
| 4582 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4583 | /* mono output */ |
| 4584 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4585 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4586 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4587 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4588 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4589 | /* Line In pin widget for input */ |
| 4590 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4591 | /* Headphone pin widget for output */ |
| 4592 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4593 | /* CD pin widget for input */ |
| 4594 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4595 | /* unmute amp left and right */ |
| 4596 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4597 | /* set connection select to line in (default select for this ADC) */ |
| 4598 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4599 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4600 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4601 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4602 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4603 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4604 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4605 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4606 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4607 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4608 | * Line In 2 = 0x03 |
| 4609 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4610 | /* mute analog inputs */ |
| 4611 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4612 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4613 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4614 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4615 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4616 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4617 | /* Unmute Front out path */ |
| 4618 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4619 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4620 | /* Unmute Headphone out path */ |
| 4621 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4622 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4623 | /* Unmute Mono out path */ |
| 4624 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4625 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4626 | { } |
| 4627 | }; |
| 4628 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4629 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4630 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4631 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4632 | */ |
| 4633 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4634 | /* Disable all GPIOs */ |
| 4635 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4636 | /* Internal speaker is connected to headphone pin */ |
| 4637 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4638 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4639 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4640 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4641 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4642 | /* Ensure all other unused pins are disabled and muted. */ |
| 4643 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4644 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4645 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4646 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4647 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4648 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4649 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4650 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4651 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4652 | /* Disable digital (SPDIF) pins */ |
| 4653 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4654 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4655 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4656 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4657 | * when acting as an output. |
| 4658 | */ |
| 4659 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4660 | |
| 4661 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4662 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4663 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4664 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4665 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4666 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4667 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4668 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4669 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4670 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4671 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4672 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4673 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4674 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4675 | * If the pin mode is changed by the user the pin mode control will |
| 4676 | * take care of enabling the pin's input/output buffers as needed. |
| 4677 | * Therefore there's no need to enable the input buffer at this |
| 4678 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4679 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4680 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4681 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4682 | * mixer ctrl) |
| 4683 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4684 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4685 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4686 | /* Mute capture amp left and right */ |
| 4687 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4688 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4689 | * in (on mic1 pin) |
| 4690 | */ |
| 4691 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4692 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4693 | /* Do the same for the second ADC: mute capture input amp and |
| 4694 | * set ADC connection to line in (on mic1 pin) |
| 4695 | */ |
| 4696 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4697 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4698 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4699 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4700 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4701 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4702 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4703 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4704 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4705 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4706 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4707 | {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] | 4708 | |
| 4709 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4710 | }; |
| 4711 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4712 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4713 | * similar laptops (adapted from Fujitsu init verbs). |
| 4714 | */ |
| 4715 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4716 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4717 | * the headphone jack. Turn this on and rely on the standard mute |
| 4718 | * methods whenever the user wants to turn these outputs off. |
| 4719 | */ |
| 4720 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4721 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4722 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4723 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4724 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4725 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4726 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4727 | /* Line In jack is connected to Line1 pin */ |
| 4728 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4729 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4730 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4731 | /* Ensure all other unused pins are disabled and muted. */ |
| 4732 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4733 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4734 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4735 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4736 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4737 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4738 | /* Disable digital (SPDIF) pins */ |
| 4739 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4740 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4741 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4742 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4743 | * bus when acting as outputs. |
| 4744 | */ |
| 4745 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4746 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4747 | |
| 4748 | /* Start with output sum widgets muted and their output gains at min */ |
| 4749 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4750 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4751 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4752 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4753 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4754 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4755 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4756 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4757 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4758 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4759 | /* Unmute Line-out pin widget amp left and right |
| 4760 | * (no equiv mixer ctrl) |
| 4761 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4762 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4763 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4764 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4765 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4766 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4767 | * will take care of enabling the pin's input/output buffers as needed. |
| 4768 | * Therefore there's no need to enable the input buffer at this |
| 4769 | * stage. |
| 4770 | */ |
| 4771 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4772 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4773 | |
| 4774 | /* Mute capture amp left and right */ |
| 4775 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4776 | /* Set ADC connection select to match default mixer setting - mic |
| 4777 | * (on mic1 pin) |
| 4778 | */ |
| 4779 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4780 | |
| 4781 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4782 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4783 | */ |
| 4784 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4785 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4786 | |
| 4787 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4788 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4789 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4790 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4791 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4792 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4793 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4794 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4795 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4796 | |
| 4797 | { } |
| 4798 | }; |
| 4799 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4800 | static struct hda_verb alc260_will_verbs[] = { |
| 4801 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4802 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4803 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4804 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4805 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4806 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4807 | {} |
| 4808 | }; |
| 4809 | |
| 4810 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4811 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4812 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4813 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4814 | |
| 4815 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4816 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4817 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4818 | |
| 4819 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4820 | {} |
| 4821 | }; |
| 4822 | |
| 4823 | /* toggle speaker-output according to the hp-jack state */ |
| 4824 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4825 | { |
| 4826 | unsigned int present; |
| 4827 | |
| 4828 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4829 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4830 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4831 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4832 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4833 | AC_VERB_SET_GPIO_DATA, 1); |
| 4834 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4835 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4836 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4837 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4838 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4839 | AC_VERB_SET_GPIO_DATA, 0); |
| 4840 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4841 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4842 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4843 | } |
| 4844 | } |
| 4845 | |
| 4846 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4847 | unsigned int res) |
| 4848 | { |
| 4849 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4850 | alc260_replacer_672v_automute(codec); |
| 4851 | } |
| 4852 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4853 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 4854 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4855 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4856 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4857 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4858 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4859 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4860 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4861 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4862 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4863 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4864 | {} |
| 4865 | }; |
| 4866 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4867 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4868 | * configuration. |
| 4869 | */ |
| 4870 | #ifdef CONFIG_SND_DEBUG |
| 4871 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4872 | 0x02, |
| 4873 | }; |
| 4874 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4875 | 0x04, 0x05, |
| 4876 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4877 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4878 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4879 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4880 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4881 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4882 | { |
| 4883 | .num_items = 7, |
| 4884 | .items = { |
| 4885 | { "MIC1 pin", 0x0 }, |
| 4886 | { "MIC2 pin", 0x1 }, |
| 4887 | { "LINE1 pin", 0x2 }, |
| 4888 | { "LINE2 pin", 0x3 }, |
| 4889 | { "CD pin", 0x4 }, |
| 4890 | { "LINE-OUT pin", 0x5 }, |
| 4891 | { "HP-OUT pin", 0x6 }, |
| 4892 | }, |
| 4893 | }, |
| 4894 | { |
| 4895 | .num_items = 8, |
| 4896 | .items = { |
| 4897 | { "MIC1 pin", 0x0 }, |
| 4898 | { "MIC2 pin", 0x1 }, |
| 4899 | { "LINE1 pin", 0x2 }, |
| 4900 | { "LINE2 pin", 0x3 }, |
| 4901 | { "CD pin", 0x4 }, |
| 4902 | { "Mixer", 0x5 }, |
| 4903 | { "LINE-OUT pin", 0x6 }, |
| 4904 | { "HP-OUT pin", 0x7 }, |
| 4905 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4906 | }, |
| 4907 | }; |
| 4908 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4909 | /* Output driver widgets */ |
| 4910 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4911 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4912 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4913 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4914 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4915 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4916 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4917 | /* Modes for retasking pin widgets |
| 4918 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4919 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4920 | * mention this restriction. At this stage it's not clear whether |
| 4921 | * this behaviour is intentional or is a hardware bug in chip |
| 4922 | * revisions available at least up until early 2006. Therefore for |
| 4923 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4924 | * choices, but if it turns out that the lack of mic bias for these |
| 4925 | * NIDs is intentional we could change their modes from |
| 4926 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4927 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4928 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4929 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4930 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4931 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4932 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4933 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4934 | |
| 4935 | /* Loopback mixer controls */ |
| 4936 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4937 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4938 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4939 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4940 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4941 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4942 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4943 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4944 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4945 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4946 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4947 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4948 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4949 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4950 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4951 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4952 | |
| 4953 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4954 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4955 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4956 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4957 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4958 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4959 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4960 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4961 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4962 | */ |
| 4963 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4964 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4965 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4966 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4967 | * this output to turn on an external amplifier. |
| 4968 | */ |
| 4969 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4970 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4971 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4972 | { } /* end */ |
| 4973 | }; |
| 4974 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4975 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4976 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4977 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4978 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4979 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4980 | /* Enable retasking pins as output, initially without power amp */ |
| 4981 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4982 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4983 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4984 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4985 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4986 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4987 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4988 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4989 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4990 | * payload also sets the generation to 0, output to be in "consumer" |
| 4991 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4992 | * control. |
| 4993 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4994 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4995 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4996 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4997 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4998 | * OUT1 sum bus when acting as an output. |
| 4999 | */ |
| 5000 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5001 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5002 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5003 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5004 | |
| 5005 | /* Start with output sum widgets muted and their output gains at min */ |
| 5006 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5007 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5008 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5009 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5010 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5011 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5012 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5013 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5014 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5015 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5016 | /* Unmute retasking pin widget output buffers since the default |
| 5017 | * state appears to be output. As the pin mode is changed by the |
| 5018 | * user the pin mode control will take care of enabling the pin's |
| 5019 | * input/output buffers as needed. |
| 5020 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5021 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5022 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5023 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5024 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5025 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5026 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5027 | /* Also unmute the mono-out pin widget */ |
| 5028 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5029 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5030 | /* Mute capture amp left and right */ |
| 5031 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5032 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5033 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5034 | */ |
| 5035 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5036 | |
| 5037 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5038 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5039 | */ |
| 5040 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5041 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5042 | |
| 5043 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5044 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5045 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5046 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5047 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5048 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5049 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5050 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5051 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5052 | |
| 5053 | { } |
| 5054 | }; |
| 5055 | #endif |
| 5056 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5057 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5058 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5059 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5060 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5061 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5062 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5063 | /* |
| 5064 | * for BIOS auto-configuration |
| 5065 | */ |
| 5066 | |
| 5067 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5068 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5069 | { |
| 5070 | hda_nid_t nid_vol; |
| 5071 | unsigned long vol_val, sw_val; |
| 5072 | char name[32]; |
| 5073 | int err; |
| 5074 | |
| 5075 | if (nid >= 0x0f && nid < 0x11) { |
| 5076 | nid_vol = nid - 0x7; |
| 5077 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5078 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5079 | } else if (nid == 0x11) { |
| 5080 | nid_vol = nid - 0x7; |
| 5081 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5082 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5083 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5084 | nid_vol = 0x08; |
| 5085 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5086 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5087 | } else |
| 5088 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5089 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5090 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5091 | /* first control for the volume widget */ |
| 5092 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5093 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5094 | if (err < 0) |
| 5095 | return err; |
| 5096 | *vol_bits |= (1 << nid_vol); |
| 5097 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5098 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5099 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5100 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5101 | return err; |
| 5102 | return 1; |
| 5103 | } |
| 5104 | |
| 5105 | /* add playback controls from the parsed DAC table */ |
| 5106 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5107 | const struct auto_pin_cfg *cfg) |
| 5108 | { |
| 5109 | hda_nid_t nid; |
| 5110 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5111 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5112 | |
| 5113 | spec->multiout.num_dacs = 1; |
| 5114 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5115 | spec->multiout.dac_nids[0] = 0x02; |
| 5116 | |
| 5117 | nid = cfg->line_out_pins[0]; |
| 5118 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5119 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5120 | if (err < 0) |
| 5121 | return err; |
| 5122 | } |
| 5123 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5124 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5125 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5126 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5127 | if (err < 0) |
| 5128 | return err; |
| 5129 | } |
| 5130 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5131 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5132 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5133 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5134 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5135 | if (err < 0) |
| 5136 | return err; |
| 5137 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5138 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5139 | } |
| 5140 | |
| 5141 | /* create playback/capture controls for input pins */ |
| 5142 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5143 | const struct auto_pin_cfg *cfg) |
| 5144 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5145 | struct hda_input_mux *imux = &spec->private_imux; |
| 5146 | int i, err, idx; |
| 5147 | |
| 5148 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5149 | if (cfg->input_pins[i] >= 0x12) { |
| 5150 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5151 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5152 | auto_pin_cfg_labels[i], idx, |
| 5153 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5154 | if (err < 0) |
| 5155 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5156 | imux->items[imux->num_items].label = |
| 5157 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5158 | imux->items[imux->num_items].index = idx; |
| 5159 | imux->num_items++; |
| 5160 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5161 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5162 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5163 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5164 | auto_pin_cfg_labels[i], idx, |
| 5165 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5166 | if (err < 0) |
| 5167 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5168 | imux->items[imux->num_items].label = |
| 5169 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5170 | imux->items[imux->num_items].index = idx; |
| 5171 | imux->num_items++; |
| 5172 | } |
| 5173 | } |
| 5174 | return 0; |
| 5175 | } |
| 5176 | |
| 5177 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5178 | hda_nid_t nid, int pin_type, |
| 5179 | int sel_idx) |
| 5180 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5181 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5182 | /* need the manual connection? */ |
| 5183 | if (nid >= 0x12) { |
| 5184 | int idx = nid - 0x12; |
| 5185 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5186 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5187 | } |
| 5188 | } |
| 5189 | |
| 5190 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5191 | { |
| 5192 | struct alc_spec *spec = codec->spec; |
| 5193 | hda_nid_t nid; |
| 5194 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5195 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5196 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5197 | if (nid) { |
| 5198 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5199 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5200 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5201 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5202 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5203 | if (nid) |
| 5204 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5205 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5206 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5207 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5208 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5209 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5210 | |
| 5211 | #define ALC260_PIN_CD_NID 0x16 |
| 5212 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5213 | { |
| 5214 | struct alc_spec *spec = codec->spec; |
| 5215 | int i; |
| 5216 | |
| 5217 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5218 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5219 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5220 | snd_hda_codec_write(codec, nid, 0, |
| 5221 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5222 | i <= AUTO_PIN_FRONT_MIC ? |
| 5223 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5224 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5225 | snd_hda_codec_write(codec, nid, 0, |
| 5226 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5227 | AMP_OUT_MUTE); |
| 5228 | } |
| 5229 | } |
| 5230 | } |
| 5231 | |
| 5232 | /* |
| 5233 | * generic initialization of ADC, input mixers and output mixers |
| 5234 | */ |
| 5235 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5236 | /* |
| 5237 | * Unmute ADC0-1 and set the default input to mic-in |
| 5238 | */ |
| 5239 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5240 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5241 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5242 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5243 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5244 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5245 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5246 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5247 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5248 | */ |
| 5249 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5250 | /* mute analog inputs */ |
| 5251 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5252 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5253 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5254 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5255 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5256 | |
| 5257 | /* |
| 5258 | * Set up output mixers (0x08 - 0x0a) |
| 5259 | */ |
| 5260 | /* set vol=0 to output mixers */ |
| 5261 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5262 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5263 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5264 | /* set up input amps for analog loopback */ |
| 5265 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5266 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5267 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5268 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5269 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5270 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5271 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5272 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5273 | { } |
| 5274 | }; |
| 5275 | |
| 5276 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5277 | { |
| 5278 | struct alc_spec *spec = codec->spec; |
| 5279 | unsigned int wcap; |
| 5280 | int err; |
| 5281 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5282 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5283 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5284 | alc260_ignore); |
| 5285 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5286 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5287 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5288 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5289 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5290 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5291 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5292 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5293 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5294 | return err; |
| 5295 | |
| 5296 | spec->multiout.max_channels = 2; |
| 5297 | |
| 5298 | if (spec->autocfg.dig_out_pin) |
| 5299 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 5300 | if (spec->kctl_alloc) |
| 5301 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 5302 | |
| 5303 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 5304 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5305 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5306 | spec->input_mux = &spec->private_imux; |
| 5307 | |
| 5308 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5309 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5310 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 5311 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5312 | spec->adc_nids = alc260_adc_nids_alt; |
| 5313 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5314 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5315 | } else { |
| 5316 | spec->adc_nids = alc260_adc_nids; |
| 5317 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5318 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5319 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5320 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5321 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame^] | 5322 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5323 | return 1; |
| 5324 | } |
| 5325 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5326 | /* additional initialization for auto-configuration model */ |
| 5327 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5328 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5329 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5330 | alc260_auto_init_multi_out(codec); |
| 5331 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5332 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5333 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5334 | } |
| 5335 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5336 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5337 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5338 | { 0x07, HDA_INPUT, 0 }, |
| 5339 | { 0x07, HDA_INPUT, 1 }, |
| 5340 | { 0x07, HDA_INPUT, 2 }, |
| 5341 | { 0x07, HDA_INPUT, 3 }, |
| 5342 | { 0x07, HDA_INPUT, 4 }, |
| 5343 | { } /* end */ |
| 5344 | }; |
| 5345 | #endif |
| 5346 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5347 | /* |
| 5348 | * ALC260 configurations |
| 5349 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5350 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5351 | [ALC260_BASIC] = "basic", |
| 5352 | [ALC260_HP] = "hp", |
| 5353 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5354 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5355 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5356 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5357 | [ALC260_WILL] = "will", |
| 5358 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5359 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5360 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5361 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5362 | [ALC260_AUTO] = "auto", |
| 5363 | }; |
| 5364 | |
| 5365 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5366 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5367 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5368 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5369 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5370 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5371 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5372 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5373 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5374 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5375 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5376 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5377 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5378 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5379 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5380 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5381 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5382 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5383 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5384 | {} |
| 5385 | }; |
| 5386 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5387 | static struct alc_config_preset alc260_presets[] = { |
| 5388 | [ALC260_BASIC] = { |
| 5389 | .mixers = { alc260_base_output_mixer, |
| 5390 | alc260_input_mixer, |
| 5391 | alc260_pc_beep_mixer, |
| 5392 | alc260_capture_mixer }, |
| 5393 | .init_verbs = { alc260_init_verbs }, |
| 5394 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5395 | .dac_nids = alc260_dac_nids, |
| 5396 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5397 | .adc_nids = alc260_adc_nids, |
| 5398 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5399 | .channel_mode = alc260_modes, |
| 5400 | .input_mux = &alc260_capture_source, |
| 5401 | }, |
| 5402 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5403 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5404 | alc260_input_mixer, |
| 5405 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5406 | .init_verbs = { alc260_init_verbs, |
| 5407 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5408 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5409 | .dac_nids = alc260_dac_nids, |
| 5410 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5411 | .adc_nids = alc260_hp_adc_nids, |
| 5412 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5413 | .channel_mode = alc260_modes, |
| 5414 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5415 | .unsol_event = alc260_hp_unsol_event, |
| 5416 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5417 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5418 | [ALC260_HP_DC7600] = { |
| 5419 | .mixers = { alc260_hp_dc7600_mixer, |
| 5420 | alc260_input_mixer, |
| 5421 | alc260_capture_alt_mixer }, |
| 5422 | .init_verbs = { alc260_init_verbs, |
| 5423 | alc260_hp_dc7600_verbs }, |
| 5424 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5425 | .dac_nids = alc260_dac_nids, |
| 5426 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5427 | .adc_nids = alc260_hp_adc_nids, |
| 5428 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5429 | .channel_mode = alc260_modes, |
| 5430 | .input_mux = &alc260_capture_source, |
| 5431 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5432 | .init_hook = alc260_hp_3012_automute, |
| 5433 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5434 | [ALC260_HP_3013] = { |
| 5435 | .mixers = { alc260_hp_3013_mixer, |
| 5436 | alc260_input_mixer, |
| 5437 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5438 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5439 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5440 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5441 | .dac_nids = alc260_dac_nids, |
| 5442 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5443 | .adc_nids = alc260_hp_adc_nids, |
| 5444 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5445 | .channel_mode = alc260_modes, |
| 5446 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5447 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5448 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5449 | }, |
| 5450 | [ALC260_FUJITSU_S702X] = { |
| 5451 | .mixers = { alc260_fujitsu_mixer, |
| 5452 | alc260_capture_mixer }, |
| 5453 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5454 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5455 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5456 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5457 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5458 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5459 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5460 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5461 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5462 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5463 | [ALC260_ACER] = { |
| 5464 | .mixers = { alc260_acer_mixer, |
| 5465 | alc260_capture_mixer }, |
| 5466 | .init_verbs = { alc260_acer_init_verbs }, |
| 5467 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5468 | .dac_nids = alc260_dac_nids, |
| 5469 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5470 | .adc_nids = alc260_dual_adc_nids, |
| 5471 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5472 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5473 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5474 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5475 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5476 | [ALC260_WILL] = { |
| 5477 | .mixers = { alc260_will_mixer, |
| 5478 | alc260_capture_mixer }, |
| 5479 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5480 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5481 | .dac_nids = alc260_dac_nids, |
| 5482 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5483 | .adc_nids = alc260_adc_nids, |
| 5484 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5485 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5486 | .channel_mode = alc260_modes, |
| 5487 | .input_mux = &alc260_capture_source, |
| 5488 | }, |
| 5489 | [ALC260_REPLACER_672V] = { |
| 5490 | .mixers = { alc260_replacer_672v_mixer, |
| 5491 | alc260_capture_mixer }, |
| 5492 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5493 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5494 | .dac_nids = alc260_dac_nids, |
| 5495 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5496 | .adc_nids = alc260_adc_nids, |
| 5497 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5498 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5499 | .channel_mode = alc260_modes, |
| 5500 | .input_mux = &alc260_capture_source, |
| 5501 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5502 | .init_hook = alc260_replacer_672v_automute, |
| 5503 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5504 | #ifdef CONFIG_SND_DEBUG |
| 5505 | [ALC260_TEST] = { |
| 5506 | .mixers = { alc260_test_mixer, |
| 5507 | alc260_capture_mixer }, |
| 5508 | .init_verbs = { alc260_test_init_verbs }, |
| 5509 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5510 | .dac_nids = alc260_test_dac_nids, |
| 5511 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5512 | .adc_nids = alc260_test_adc_nids, |
| 5513 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5514 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5515 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5516 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5517 | }, |
| 5518 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5519 | }; |
| 5520 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5521 | static int patch_alc260(struct hda_codec *codec) |
| 5522 | { |
| 5523 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5524 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5525 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5526 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5527 | if (spec == NULL) |
| 5528 | return -ENOMEM; |
| 5529 | |
| 5530 | codec->spec = spec; |
| 5531 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5532 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5533 | alc260_models, |
| 5534 | alc260_cfg_tbl); |
| 5535 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5536 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5537 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5538 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5539 | } |
| 5540 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5541 | if (board_config == ALC260_AUTO) { |
| 5542 | /* automatic parse from the BIOS config */ |
| 5543 | err = alc260_parse_auto_config(codec); |
| 5544 | if (err < 0) { |
| 5545 | alc_free(codec); |
| 5546 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5547 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5548 | printk(KERN_INFO |
| 5549 | "hda_codec: Cannot set up configuration " |
| 5550 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5551 | board_config = ALC260_BASIC; |
| 5552 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5553 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5554 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5555 | if (board_config != ALC260_AUTO) |
| 5556 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5557 | |
| 5558 | spec->stream_name_analog = "ALC260 Analog"; |
| 5559 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5560 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5561 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5562 | spec->stream_name_digital = "ALC260 Digital"; |
| 5563 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5564 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5565 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5566 | spec->vmaster_nid = 0x08; |
| 5567 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5568 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5569 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5570 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5571 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5572 | if (!spec->loopback.amplist) |
| 5573 | spec->loopback.amplist = alc260_loopbacks; |
| 5574 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5575 | |
| 5576 | return 0; |
| 5577 | } |
| 5578 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5579 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5580 | /* |
| 5581 | * ALC882 support |
| 5582 | * |
| 5583 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5584 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5585 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5586 | * 6-channel independent captures. |
| 5587 | * |
| 5588 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5589 | * driver yet). |
| 5590 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5591 | #define ALC882_DIGOUT_NID 0x06 |
| 5592 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5593 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5594 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5595 | { 8, NULL } |
| 5596 | }; |
| 5597 | |
| 5598 | static hda_nid_t alc882_dac_nids[4] = { |
| 5599 | /* front, rear, clfe, rear_surr */ |
| 5600 | 0x02, 0x03, 0x04, 0x05 |
| 5601 | }; |
| 5602 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5603 | /* identical with ALC880 */ |
| 5604 | #define alc882_adc_nids alc880_adc_nids |
| 5605 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5606 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5607 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5608 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5609 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5610 | /* input MUX */ |
| 5611 | /* FIXME: should be a matrix-type input source selection */ |
| 5612 | |
| 5613 | static struct hda_input_mux alc882_capture_source = { |
| 5614 | .num_items = 4, |
| 5615 | .items = { |
| 5616 | { "Mic", 0x0 }, |
| 5617 | { "Front Mic", 0x1 }, |
| 5618 | { "Line", 0x2 }, |
| 5619 | { "CD", 0x4 }, |
| 5620 | }, |
| 5621 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5622 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5623 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5624 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5625 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5626 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5627 | { |
| 5628 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5629 | struct alc_spec *spec = codec->spec; |
| 5630 | const struct hda_input_mux *imux = spec->input_mux; |
| 5631 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5632 | hda_nid_t nid = spec->capsrc_nids ? |
| 5633 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5634 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5635 | unsigned int i, idx; |
| 5636 | |
| 5637 | idx = ucontrol->value.enumerated.item[0]; |
| 5638 | if (idx >= imux->num_items) |
| 5639 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5640 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5641 | return 0; |
| 5642 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5643 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5644 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5645 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5646 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5647 | } |
| 5648 | *cur_val = idx; |
| 5649 | return 1; |
| 5650 | } |
| 5651 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5652 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5653 | * 2ch mode |
| 5654 | */ |
| 5655 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5656 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5657 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5658 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5659 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5660 | { } /* end */ |
| 5661 | }; |
| 5662 | |
| 5663 | /* |
| 5664 | * 6ch mode |
| 5665 | */ |
| 5666 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5667 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5668 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5669 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5670 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5671 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5672 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5673 | { } /* end */ |
| 5674 | }; |
| 5675 | |
| 5676 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5677 | { 2, alc882_3ST_ch2_init }, |
| 5678 | { 6, alc882_3ST_ch6_init }, |
| 5679 | }; |
| 5680 | |
| 5681 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5682 | * 6ch mode |
| 5683 | */ |
| 5684 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5685 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5686 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5687 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5688 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5689 | { } /* end */ |
| 5690 | }; |
| 5691 | |
| 5692 | /* |
| 5693 | * 8ch mode |
| 5694 | */ |
| 5695 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5696 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5697 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5698 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5699 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5700 | { } /* end */ |
| 5701 | }; |
| 5702 | |
| 5703 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5704 | { 6, alc882_sixstack_ch6_init }, |
| 5705 | { 8, alc882_sixstack_ch8_init }, |
| 5706 | }; |
| 5707 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5708 | /* |
| 5709 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5710 | */ |
| 5711 | |
| 5712 | /* |
| 5713 | * 2ch mode |
| 5714 | */ |
| 5715 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5716 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5717 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5718 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5719 | { } /* end */ |
| 5720 | }; |
| 5721 | |
| 5722 | /* |
| 5723 | * 6ch mode |
| 5724 | */ |
| 5725 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5726 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5727 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5728 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5729 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5730 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5731 | { } /* end */ |
| 5732 | }; |
| 5733 | |
| 5734 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5735 | { 2, alc885_mbp_ch2_init }, |
| 5736 | { 6, alc885_mbp_ch6_init }, |
| 5737 | }; |
| 5738 | |
| 5739 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5740 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5741 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5742 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5743 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5744 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5745 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5746 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5747 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5748 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5749 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5750 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5751 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5752 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5753 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5754 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5755 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5756 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5757 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5758 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5759 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5760 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5761 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5762 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5763 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5764 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5765 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5766 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5767 | { } /* end */ |
| 5768 | }; |
| 5769 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5770 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5771 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5772 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5773 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5774 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5775 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5776 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5777 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5778 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5779 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5780 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5781 | { } /* end */ |
| 5782 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5783 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5784 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5785 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5786 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5787 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5788 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5789 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5790 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5791 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5792 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5793 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5794 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5795 | { } /* end */ |
| 5796 | }; |
| 5797 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5798 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5799 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5800 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5801 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5802 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5803 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5804 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5805 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5806 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5807 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5808 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5809 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5810 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5811 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5812 | { } /* end */ |
| 5813 | }; |
| 5814 | |
| 5815 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5816 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5817 | */ |
| 5818 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5819 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5820 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5821 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5822 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5823 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5824 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5825 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5826 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5827 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5828 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5829 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5830 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5831 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5832 | { } /* end */ |
| 5833 | }; |
| 5834 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5835 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5836 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5837 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5838 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5839 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5840 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5841 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5842 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5843 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5844 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5846 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5847 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5848 | { } /* end */ |
| 5849 | }; |
| 5850 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5851 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5852 | { |
| 5853 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5854 | .name = "Channel Mode", |
| 5855 | .info = alc_ch_mode_info, |
| 5856 | .get = alc_ch_mode_get, |
| 5857 | .put = alc_ch_mode_put, |
| 5858 | }, |
| 5859 | { } /* end */ |
| 5860 | }; |
| 5861 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5862 | static struct hda_verb alc882_init_verbs[] = { |
| 5863 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5864 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5865 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5866 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5867 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5868 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5869 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5870 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5871 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5872 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5873 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5874 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5875 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5876 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5877 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5878 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5879 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5880 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5881 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5882 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5883 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5884 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5885 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5886 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5887 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5888 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5889 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5890 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5891 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5892 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5893 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5894 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5895 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5896 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5897 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5898 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5899 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5900 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5901 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5902 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5903 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5904 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5905 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5906 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5907 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5908 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5909 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5910 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5911 | |
| 5912 | /* FIXME: use matrix-type input source selection */ |
| 5913 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5914 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5915 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5916 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5917 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5918 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5919 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5920 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5921 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5922 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5923 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5924 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5925 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5926 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5927 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5928 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5929 | /* ADC1: mute amp left and right */ |
| 5930 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5931 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5932 | /* ADC2: mute amp left and right */ |
| 5933 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5934 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5935 | /* ADC3: mute amp left and right */ |
| 5936 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5937 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5938 | |
| 5939 | { } |
| 5940 | }; |
| 5941 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5942 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5943 | /* change to EAPD mode */ |
| 5944 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5945 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5946 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5947 | }; |
| 5948 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5949 | /* Mac Pro test */ |
| 5950 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5951 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5952 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5953 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5954 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5955 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5956 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5957 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5958 | { } /* end */ |
| 5959 | }; |
| 5960 | |
| 5961 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5962 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5963 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5964 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5965 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5966 | /* Front Pin: output 0 (0x0c) */ |
| 5967 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5968 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5969 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5970 | /* Front Mic pin: input vref at 80% */ |
| 5971 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5972 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5973 | /* Speaker: output */ |
| 5974 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5975 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5976 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5977 | /* Headphone output (output 0 - 0x0c) */ |
| 5978 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5979 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5980 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5981 | |
| 5982 | /* FIXME: use matrix-type input source selection */ |
| 5983 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5984 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5985 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5986 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5987 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5988 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5989 | /* Input mixer2 */ |
| 5990 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5991 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5992 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5993 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5994 | /* Input mixer3 */ |
| 5995 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5996 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5997 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5998 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5999 | /* ADC1: mute amp left and right */ |
| 6000 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6001 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6002 | /* ADC2: mute amp left and right */ |
| 6003 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6004 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6005 | /* ADC3: mute amp left and right */ |
| 6006 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6007 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6008 | |
| 6009 | { } |
| 6010 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6011 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6012 | /* Macbook Pro rev3 */ |
| 6013 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6014 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6015 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6016 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6017 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6018 | /* Rear mixer */ |
| 6019 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6020 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6021 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6022 | /* Front Pin: output 0 (0x0c) */ |
| 6023 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6024 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6025 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6026 | /* HP Pin: output 0 (0x0d) */ |
| 6027 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6028 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6029 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6030 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6031 | /* Mic (rear) pin: input vref at 80% */ |
| 6032 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6033 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6034 | /* Front Mic pin: input vref at 80% */ |
| 6035 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6036 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6037 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6038 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6039 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6040 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6041 | |
| 6042 | /* FIXME: use matrix-type input source selection */ |
| 6043 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6044 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6045 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6046 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6047 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6049 | /* Input mixer2 */ |
| 6050 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6051 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6052 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6053 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6054 | /* Input mixer3 */ |
| 6055 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6056 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6058 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6059 | /* ADC1: mute amp left and right */ |
| 6060 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6061 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6062 | /* ADC2: mute amp left and right */ |
| 6063 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6064 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6065 | /* ADC3: mute amp left and right */ |
| 6066 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6067 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6068 | |
| 6069 | { } |
| 6070 | }; |
| 6071 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6072 | /* iMac 24 mixer. */ |
| 6073 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6074 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6075 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6076 | { } /* end */ |
| 6077 | }; |
| 6078 | |
| 6079 | /* iMac 24 init verbs. */ |
| 6080 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6081 | /* Internal speakers: output 0 (0x0c) */ |
| 6082 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6083 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6084 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6085 | /* Internal speakers: output 0 (0x0c) */ |
| 6086 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6087 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6088 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6089 | /* Headphone: output 0 (0x0c) */ |
| 6090 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6091 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6092 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6093 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6094 | /* Front Mic: input vref at 80% */ |
| 6095 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6096 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6097 | { } |
| 6098 | }; |
| 6099 | |
| 6100 | /* Toggle speaker-output according to the hp-jack state */ |
| 6101 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 6102 | { |
| 6103 | unsigned int present; |
| 6104 | |
| 6105 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6106 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6107 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 6108 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6109 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 6110 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6111 | } |
| 6112 | |
| 6113 | /* Processes unsolicited events. */ |
| 6114 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6115 | unsigned int res) |
| 6116 | { |
| 6117 | /* Headphone insertion or removal. */ |
| 6118 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6119 | alc885_imac24_automute(codec); |
| 6120 | } |
| 6121 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6122 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6123 | { |
| 6124 | unsigned int present; |
| 6125 | |
| 6126 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6127 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6128 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6129 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6130 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6131 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6132 | |
| 6133 | } |
| 6134 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6135 | unsigned int res) |
| 6136 | { |
| 6137 | /* Headphone insertion or removal. */ |
| 6138 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6139 | alc885_mbp3_automute(codec); |
| 6140 | } |
| 6141 | |
| 6142 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6143 | static struct hda_verb alc882_targa_verbs[] = { |
| 6144 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6145 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6146 | |
| 6147 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6148 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6149 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6150 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6151 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6152 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6153 | |
| 6154 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6155 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6156 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6157 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6158 | { } /* end */ |
| 6159 | }; |
| 6160 | |
| 6161 | /* toggle speaker-output according to the hp-jack state */ |
| 6162 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6163 | { |
| 6164 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6165 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6166 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6167 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6168 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6169 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6170 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6171 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6172 | } |
| 6173 | |
| 6174 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6175 | { |
| 6176 | /* Looks like the unsol event is incompatible with the standard |
| 6177 | * definition. 4bit tag is placed at 26 bit! |
| 6178 | */ |
| 6179 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6180 | alc882_targa_automute(codec); |
| 6181 | } |
| 6182 | } |
| 6183 | |
| 6184 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 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 | |
| 6188 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6189 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6190 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6191 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6192 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6193 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6194 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6195 | |
| 6196 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6197 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6198 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6199 | { } /* end */ |
| 6200 | }; |
| 6201 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6202 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6203 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6204 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6205 | |
| 6206 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6207 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6208 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6209 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6210 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6211 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6212 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6213 | |
| 6214 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6215 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6216 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6217 | { } /* end */ |
| 6218 | }; |
| 6219 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6220 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6221 | { |
| 6222 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6223 | |
| 6224 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6225 | AC_VERB_GET_GPIO_DATA, 0); |
| 6226 | |
| 6227 | if (!muted) |
| 6228 | gpiostate |= (1 << pin); |
| 6229 | else |
| 6230 | gpiostate &= ~(1 << pin); |
| 6231 | |
| 6232 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6233 | AC_VERB_GET_GPIO_MASK, 0); |
| 6234 | gpiomask |= (1 << pin); |
| 6235 | |
| 6236 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6237 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6238 | gpiodir |= (1 << pin); |
| 6239 | |
| 6240 | |
| 6241 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6242 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6243 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6244 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6245 | |
| 6246 | msleep(1); |
| 6247 | |
| 6248 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6249 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6250 | } |
| 6251 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6252 | /* set up GPIO at initialization */ |
| 6253 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6254 | { |
| 6255 | alc882_gpio_mute(codec, 0, 0); |
| 6256 | alc882_gpio_mute(codec, 1, 0); |
| 6257 | } |
| 6258 | |
| 6259 | /* set up GPIO and update auto-muting at initialization */ |
| 6260 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6261 | { |
| 6262 | alc885_macpro_init_hook(codec); |
| 6263 | alc885_imac24_automute(codec); |
| 6264 | } |
| 6265 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6266 | /* |
| 6267 | * generic initialization of ADC, input mixers and output mixers |
| 6268 | */ |
| 6269 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6270 | /* |
| 6271 | * Unmute ADC0-2 and set the default input to mic-in |
| 6272 | */ |
| 6273 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6274 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6275 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6276 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6277 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6278 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6279 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6280 | /* 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] | 6281 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6282 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6283 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6284 | */ |
| 6285 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6286 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6287 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6288 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6289 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6290 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6291 | |
| 6292 | /* |
| 6293 | * Set up output mixers (0x0c - 0x0f) |
| 6294 | */ |
| 6295 | /* set vol=0 to output mixers */ |
| 6296 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6297 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6299 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6300 | /* set up input amps for analog loopback */ |
| 6301 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6302 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6303 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6304 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6305 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6306 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6307 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6308 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6309 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6310 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6311 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6312 | |
| 6313 | /* FIXME: use matrix-type input source selection */ |
| 6314 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6315 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6316 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6317 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6318 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6319 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6320 | /* Input mixer2 */ |
| 6321 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6322 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6323 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6324 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6325 | /* Input mixer3 */ |
| 6326 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6327 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6328 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6329 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6330 | |
| 6331 | { } |
| 6332 | }; |
| 6333 | |
| 6334 | /* capture mixer elements */ |
| 6335 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 6336 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6337 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6338 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6339 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6340 | { |
| 6341 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6342 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6343 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6344 | */ |
| 6345 | /* .name = "Capture Source", */ |
| 6346 | .name = "Input Source", |
| 6347 | .count = 2, |
| 6348 | .info = alc882_mux_enum_info, |
| 6349 | .get = alc882_mux_enum_get, |
| 6350 | .put = alc882_mux_enum_put, |
| 6351 | }, |
| 6352 | { } /* end */ |
| 6353 | }; |
| 6354 | |
| 6355 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 6356 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 6357 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 6358 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 6359 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 6360 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 6361 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 6362 | { |
| 6363 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6364 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6365 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6366 | */ |
| 6367 | /* .name = "Capture Source", */ |
| 6368 | .name = "Input Source", |
| 6369 | .count = 3, |
| 6370 | .info = alc882_mux_enum_info, |
| 6371 | .get = alc882_mux_enum_get, |
| 6372 | .put = alc882_mux_enum_put, |
| 6373 | }, |
| 6374 | { } /* end */ |
| 6375 | }; |
| 6376 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6377 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6378 | #define alc882_loopbacks alc880_loopbacks |
| 6379 | #endif |
| 6380 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6381 | /* pcm configuration: identiacal with ALC880 */ |
| 6382 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6383 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6384 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6385 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6386 | |
| 6387 | /* |
| 6388 | * configuration and preset |
| 6389 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6390 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6391 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6392 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6393 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6394 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6395 | [ALC882_TARGA] = "targa", |
| 6396 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6397 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6398 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6399 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6400 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6401 | [ALC882_AUTO] = "auto", |
| 6402 | }; |
| 6403 | |
| 6404 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6405 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6406 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6407 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6408 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6409 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6410 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6411 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6412 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6413 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6414 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6415 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6416 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6417 | {} |
| 6418 | }; |
| 6419 | |
| 6420 | static struct alc_config_preset alc882_presets[] = { |
| 6421 | [ALC882_3ST_DIG] = { |
| 6422 | .mixers = { alc882_base_mixer }, |
| 6423 | .init_verbs = { alc882_init_verbs }, |
| 6424 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6425 | .dac_nids = alc882_dac_nids, |
| 6426 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6427 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6428 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6429 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6430 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6431 | .input_mux = &alc882_capture_source, |
| 6432 | }, |
| 6433 | [ALC882_6ST_DIG] = { |
| 6434 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6435 | .init_verbs = { alc882_init_verbs }, |
| 6436 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6437 | .dac_nids = alc882_dac_nids, |
| 6438 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6439 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6440 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6441 | .channel_mode = alc882_sixstack_modes, |
| 6442 | .input_mux = &alc882_capture_source, |
| 6443 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6444 | [ALC882_ARIMA] = { |
| 6445 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6446 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6447 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6448 | .dac_nids = alc882_dac_nids, |
| 6449 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6450 | .channel_mode = alc882_sixstack_modes, |
| 6451 | .input_mux = &alc882_capture_source, |
| 6452 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6453 | [ALC882_W2JC] = { |
| 6454 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6455 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6456 | alc880_gpio1_init_verbs }, |
| 6457 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6458 | .dac_nids = alc882_dac_nids, |
| 6459 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6460 | .channel_mode = alc880_threestack_modes, |
| 6461 | .need_dac_fix = 1, |
| 6462 | .input_mux = &alc882_capture_source, |
| 6463 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6464 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6465 | [ALC885_MBP3] = { |
| 6466 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6467 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6468 | alc880_gpio1_init_verbs }, |
| 6469 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6470 | .dac_nids = alc882_dac_nids, |
| 6471 | .channel_mode = alc885_mbp_6ch_modes, |
| 6472 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6473 | .input_mux = &alc882_capture_source, |
| 6474 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6475 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6476 | .unsol_event = alc885_mbp3_unsol_event, |
| 6477 | .init_hook = alc885_mbp3_automute, |
| 6478 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6479 | [ALC885_MACPRO] = { |
| 6480 | .mixers = { alc882_macpro_mixer }, |
| 6481 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6482 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6483 | .dac_nids = alc882_dac_nids, |
| 6484 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6485 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6486 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6487 | .channel_mode = alc882_ch_modes, |
| 6488 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6489 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6490 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6491 | [ALC885_IMAC24] = { |
| 6492 | .mixers = { alc885_imac24_mixer }, |
| 6493 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6494 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6495 | .dac_nids = alc882_dac_nids, |
| 6496 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6497 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6498 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6499 | .channel_mode = alc882_ch_modes, |
| 6500 | .input_mux = &alc882_capture_source, |
| 6501 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6502 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6503 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6504 | [ALC882_TARGA] = { |
| 6505 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6506 | alc882_capture_mixer }, |
| 6507 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6508 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6509 | .dac_nids = alc882_dac_nids, |
| 6510 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6511 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6512 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6513 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6514 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6515 | .channel_mode = alc882_3ST_6ch_modes, |
| 6516 | .need_dac_fix = 1, |
| 6517 | .input_mux = &alc882_capture_source, |
| 6518 | .unsol_event = alc882_targa_unsol_event, |
| 6519 | .init_hook = alc882_targa_automute, |
| 6520 | }, |
| 6521 | [ALC882_ASUS_A7J] = { |
| 6522 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6523 | alc882_capture_mixer }, |
| 6524 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6525 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6526 | .dac_nids = alc882_dac_nids, |
| 6527 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6528 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6529 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6530 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6531 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6532 | .channel_mode = alc882_3ST_6ch_modes, |
| 6533 | .need_dac_fix = 1, |
| 6534 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6535 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6536 | [ALC882_ASUS_A7M] = { |
| 6537 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6538 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6539 | alc880_gpio1_init_verbs, |
| 6540 | alc882_asus_a7m_verbs }, |
| 6541 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6542 | .dac_nids = alc882_dac_nids, |
| 6543 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6544 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6545 | .channel_mode = alc880_threestack_modes, |
| 6546 | .need_dac_fix = 1, |
| 6547 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6548 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6549 | }; |
| 6550 | |
| 6551 | |
| 6552 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6553 | * Pin config fixes |
| 6554 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6555 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6556 | PINFIX_ABIT_AW9D_MAX |
| 6557 | }; |
| 6558 | |
| 6559 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6560 | { 0x15, 0x01080104 }, /* side */ |
| 6561 | { 0x16, 0x01011012 }, /* rear */ |
| 6562 | { 0x17, 0x01016011 }, /* clfe */ |
| 6563 | { } |
| 6564 | }; |
| 6565 | |
| 6566 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6567 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6568 | }; |
| 6569 | |
| 6570 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6571 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6572 | {} |
| 6573 | }; |
| 6574 | |
| 6575 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6576 | * BIOS auto configuration |
| 6577 | */ |
| 6578 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6579 | hda_nid_t nid, int pin_type, |
| 6580 | int dac_idx) |
| 6581 | { |
| 6582 | /* set as output */ |
| 6583 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6584 | int idx; |
| 6585 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6586 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6587 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6588 | idx = 4; |
| 6589 | else |
| 6590 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6591 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6592 | |
| 6593 | } |
| 6594 | |
| 6595 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6596 | { |
| 6597 | struct alc_spec *spec = codec->spec; |
| 6598 | int i; |
| 6599 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6600 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6601 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6602 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6603 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6604 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6605 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6606 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6607 | } |
| 6608 | } |
| 6609 | |
| 6610 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6611 | { |
| 6612 | struct alc_spec *spec = codec->spec; |
| 6613 | hda_nid_t pin; |
| 6614 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6615 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6616 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6617 | /* use dac 0 */ |
| 6618 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6619 | pin = spec->autocfg.speaker_pins[0]; |
| 6620 | if (pin) |
| 6621 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6622 | } |
| 6623 | |
| 6624 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6625 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6626 | |
| 6627 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6628 | { |
| 6629 | struct alc_spec *spec = codec->spec; |
| 6630 | int i; |
| 6631 | |
| 6632 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6633 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6634 | unsigned int vref; |
| 6635 | if (!nid) |
| 6636 | continue; |
| 6637 | vref = PIN_IN; |
| 6638 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6639 | unsigned int pincap; |
| 6640 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6641 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6642 | AC_PINCAP_VREF_80) |
| 6643 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6644 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6645 | snd_hda_codec_write(codec, nid, 0, |
| 6646 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6647 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6648 | snd_hda_codec_write(codec, nid, 0, |
| 6649 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6650 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6651 | } |
| 6652 | } |
| 6653 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6654 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 6655 | { |
| 6656 | struct alc_spec *spec = codec->spec; |
| 6657 | const struct hda_input_mux *imux = spec->input_mux; |
| 6658 | int c; |
| 6659 | |
| 6660 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 6661 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 6662 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 6663 | int conns, mute, idx, item; |
| 6664 | |
| 6665 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 6666 | ARRAY_SIZE(conn_list)); |
| 6667 | if (conns < 0) |
| 6668 | continue; |
| 6669 | for (idx = 0; idx < conns; idx++) { |
| 6670 | /* if the current connection is the selected one, |
| 6671 | * unmute it as default - otherwise mute it |
| 6672 | */ |
| 6673 | mute = AMP_IN_MUTE(idx); |
| 6674 | for (item = 0; item < imux->num_items; item++) { |
| 6675 | if (imux->items[item].index == idx) { |
| 6676 | if (spec->cur_mux[c] == item) |
| 6677 | mute = AMP_IN_UNMUTE(idx); |
| 6678 | break; |
| 6679 | } |
| 6680 | } |
| 6681 | snd_hda_codec_write(codec, nid, 0, |
| 6682 | AC_VERB_SET_AMP_GAIN_MUTE, mute); |
| 6683 | } |
| 6684 | } |
| 6685 | } |
| 6686 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6687 | /* add mic boosts if needed */ |
| 6688 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6689 | { |
| 6690 | struct alc_spec *spec = codec->spec; |
| 6691 | int err; |
| 6692 | hda_nid_t nid; |
| 6693 | |
| 6694 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6695 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6696 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6697 | "Mic Boost", |
| 6698 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6699 | if (err < 0) |
| 6700 | return err; |
| 6701 | } |
| 6702 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6703 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6704 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6705 | "Front Mic Boost", |
| 6706 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6707 | if (err < 0) |
| 6708 | return err; |
| 6709 | } |
| 6710 | return 0; |
| 6711 | } |
| 6712 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6713 | /* almost identical with ALC880 parser... */ |
| 6714 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6715 | { |
| 6716 | struct alc_spec *spec = codec->spec; |
| 6717 | int err = alc880_parse_auto_config(codec); |
| 6718 | |
| 6719 | if (err < 0) |
| 6720 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6721 | else if (!err) |
| 6722 | return 0; /* no config found */ |
| 6723 | |
| 6724 | err = alc_auto_add_mic_boost(codec); |
| 6725 | if (err < 0) |
| 6726 | return err; |
| 6727 | |
| 6728 | /* hack - override the init verbs */ |
| 6729 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6730 | |
| 6731 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6732 | } |
| 6733 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6734 | /* additional initialization for auto-configuration model */ |
| 6735 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6736 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6737 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6738 | alc882_auto_init_multi_out(codec); |
| 6739 | alc882_auto_init_hp_out(codec); |
| 6740 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6741 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6742 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6743 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6744 | } |
| 6745 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6746 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6747 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6748 | static int patch_alc882(struct hda_codec *codec) |
| 6749 | { |
| 6750 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6751 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6752 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6753 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6754 | if (spec == NULL) |
| 6755 | return -ENOMEM; |
| 6756 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6757 | codec->spec = spec; |
| 6758 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6759 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6760 | alc882_models, |
| 6761 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6762 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6763 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6764 | /* Pick up systems that don't supply PCI SSID */ |
| 6765 | switch (codec->subsystem_id) { |
| 6766 | case 0x106b0c00: /* Mac Pro */ |
| 6767 | board_config = ALC885_MACPRO; |
| 6768 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6769 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 6770 | case 0x106b2800: /* AppleTV */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6771 | board_config = ALC885_IMAC24; |
| 6772 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6773 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 6774 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6775 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6776 | case 0x106b3600: /* Macbook 3.1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6777 | board_config = ALC885_MBP3; |
| 6778 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6779 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6780 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 6781 | if (codec->revision_id == 0x100101 || |
| 6782 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6783 | alc_free(codec); |
| 6784 | return patch_alc883(codec); |
| 6785 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6786 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6787 | "trying auto-probe from BIOS...\n"); |
| 6788 | board_config = ALC882_AUTO; |
| 6789 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6790 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6791 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6792 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6793 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6794 | if (board_config == ALC882_AUTO) { |
| 6795 | /* automatic parse from the BIOS config */ |
| 6796 | err = alc882_parse_auto_config(codec); |
| 6797 | if (err < 0) { |
| 6798 | alc_free(codec); |
| 6799 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6800 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6801 | printk(KERN_INFO |
| 6802 | "hda_codec: Cannot set up configuration " |
| 6803 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6804 | board_config = ALC882_3ST_DIG; |
| 6805 | } |
| 6806 | } |
| 6807 | |
| 6808 | if (board_config != ALC882_AUTO) |
| 6809 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6810 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 6811 | if (codec->vendor_id == 0x10ec0885) { |
| 6812 | spec->stream_name_analog = "ALC885 Analog"; |
| 6813 | spec->stream_name_digital = "ALC885 Digital"; |
| 6814 | } else { |
| 6815 | spec->stream_name_analog = "ALC882 Analog"; |
| 6816 | spec->stream_name_digital = "ALC882 Digital"; |
| 6817 | } |
| 6818 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6819 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6820 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6821 | /* FIXME: setup DAC5 */ |
| 6822 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6823 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6824 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6825 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6826 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6827 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6828 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6829 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6830 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6831 | /* get type */ |
| 6832 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6833 | if (wcap != AC_WID_AUD_IN) { |
| 6834 | spec->adc_nids = alc882_adc_nids_alt; |
| 6835 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6836 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6837 | spec->mixers[spec->num_mixers] = |
| 6838 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6839 | spec->num_mixers++; |
| 6840 | } else { |
| 6841 | spec->adc_nids = alc882_adc_nids; |
| 6842 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6843 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6844 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6845 | spec->num_mixers++; |
| 6846 | } |
| 6847 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6848 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6849 | spec->vmaster_nid = 0x0c; |
| 6850 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6851 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6852 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6853 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6854 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6855 | if (!spec->loopback.amplist) |
| 6856 | spec->loopback.amplist = alc882_loopbacks; |
| 6857 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6858 | |
| 6859 | return 0; |
| 6860 | } |
| 6861 | |
| 6862 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6863 | * ALC883 support |
| 6864 | * |
| 6865 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6866 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6867 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6868 | * 6-channel independent captures. |
| 6869 | * |
| 6870 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6871 | * driver yet). |
| 6872 | */ |
| 6873 | #define ALC883_DIGOUT_NID 0x06 |
| 6874 | #define ALC883_DIGIN_NID 0x0a |
| 6875 | |
| 6876 | static hda_nid_t alc883_dac_nids[4] = { |
| 6877 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6878 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6879 | }; |
| 6880 | |
| 6881 | static hda_nid_t alc883_adc_nids[2] = { |
| 6882 | /* ADC1-2 */ |
| 6883 | 0x08, 0x09, |
| 6884 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6885 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6886 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6887 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6888 | /* input MUX */ |
| 6889 | /* FIXME: should be a matrix-type input source selection */ |
| 6890 | |
| 6891 | static struct hda_input_mux alc883_capture_source = { |
| 6892 | .num_items = 4, |
| 6893 | .items = { |
| 6894 | { "Mic", 0x0 }, |
| 6895 | { "Front Mic", 0x1 }, |
| 6896 | { "Line", 0x2 }, |
| 6897 | { "CD", 0x4 }, |
| 6898 | }, |
| 6899 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6900 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6901 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6902 | .num_items = 4, |
| 6903 | .items = { |
| 6904 | { "Mic", 0x1 }, |
| 6905 | { "Front Mic", 0x0 }, |
| 6906 | { "Line", 0x2 }, |
| 6907 | { "CD", 0x4 }, |
| 6908 | }, |
| 6909 | }; |
| 6910 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6911 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6912 | .num_items = 2, |
| 6913 | .items = { |
| 6914 | { "Mic", 0x1 }, |
| 6915 | { "Line", 0x2 }, |
| 6916 | }, |
| 6917 | }; |
| 6918 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6919 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6920 | .num_items = 4, |
| 6921 | .items = { |
| 6922 | { "Mic", 0x0 }, |
| 6923 | { "iMic", 0x1 }, |
| 6924 | { "Line", 0x2 }, |
| 6925 | { "CD", 0x4 }, |
| 6926 | }, |
| 6927 | }; |
| 6928 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6929 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6930 | .num_items = 2, |
| 6931 | .items = { |
| 6932 | { "Mic", 0x0 }, |
| 6933 | { "Int Mic", 0x1 }, |
| 6934 | }, |
| 6935 | }; |
| 6936 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 6937 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6938 | .num_items = 3, |
| 6939 | .items = { |
| 6940 | { "Mic", 0x0 }, |
| 6941 | { "Front Mic", 0x1 }, |
| 6942 | { "Line", 0x4 }, |
| 6943 | }, |
| 6944 | }; |
| 6945 | |
| 6946 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6947 | .num_items = 2, |
| 6948 | .items = { |
| 6949 | { "Mic", 0x0 }, |
| 6950 | { "Line", 0x2 }, |
| 6951 | }, |
| 6952 | }; |
| 6953 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6954 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6955 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6956 | /* ALC883 has the ALC882-type input selection */ |
| 6957 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6958 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6959 | /* |
| 6960 | * 2ch mode |
| 6961 | */ |
| 6962 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6963 | { 2, NULL } |
| 6964 | }; |
| 6965 | |
| 6966 | /* |
| 6967 | * 2ch mode |
| 6968 | */ |
| 6969 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6970 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6971 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6972 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6973 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6974 | { } /* end */ |
| 6975 | }; |
| 6976 | |
| 6977 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6978 | * 4ch mode |
| 6979 | */ |
| 6980 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6981 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6982 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6983 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6984 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6985 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6986 | { } /* end */ |
| 6987 | }; |
| 6988 | |
| 6989 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6990 | * 6ch mode |
| 6991 | */ |
| 6992 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6993 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6994 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6995 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6996 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6997 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6998 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6999 | { } /* end */ |
| 7000 | }; |
| 7001 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7002 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7003 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7004 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7005 | { 6, alc883_3ST_ch6_init }, |
| 7006 | }; |
| 7007 | |
| 7008 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7009 | * 2ch mode |
| 7010 | */ |
| 7011 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7012 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7013 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7014 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7015 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7016 | { } /* end */ |
| 7017 | }; |
| 7018 | |
| 7019 | /* |
| 7020 | * 4ch mode |
| 7021 | */ |
| 7022 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7023 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7024 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7025 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7026 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7027 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7028 | { } /* end */ |
| 7029 | }; |
| 7030 | |
| 7031 | /* |
| 7032 | * 6ch mode |
| 7033 | */ |
| 7034 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7035 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7036 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7037 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7038 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7039 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7040 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7041 | { } /* end */ |
| 7042 | }; |
| 7043 | |
| 7044 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7045 | { 2, alc883_3ST_ch2_intel_init }, |
| 7046 | { 4, alc883_3ST_ch4_intel_init }, |
| 7047 | { 6, alc883_3ST_ch6_intel_init }, |
| 7048 | }; |
| 7049 | |
| 7050 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7051 | * 6ch mode |
| 7052 | */ |
| 7053 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7054 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7055 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7056 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7057 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7058 | { } /* end */ |
| 7059 | }; |
| 7060 | |
| 7061 | /* |
| 7062 | * 8ch mode |
| 7063 | */ |
| 7064 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7065 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7066 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7067 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7068 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7069 | { } /* end */ |
| 7070 | }; |
| 7071 | |
| 7072 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7073 | { 6, alc883_sixstack_ch6_init }, |
| 7074 | { 8, alc883_sixstack_ch8_init }, |
| 7075 | }; |
| 7076 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7077 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7078 | /* eanable EAPD on medion laptop */ |
| 7079 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7080 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7081 | { } |
| 7082 | }; |
| 7083 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7084 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7085 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7086 | */ |
| 7087 | |
| 7088 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7089 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7090 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7091 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7092 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7093 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7094 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7095 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7096 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7097 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7098 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7099 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7100 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7101 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7102 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7103 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7104 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7105 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7106 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7107 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7108 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7109 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7110 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7111 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7112 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7113 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7114 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7115 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7116 | { |
| 7117 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7118 | /* .name = "Capture Source", */ |
| 7119 | .name = "Input Source", |
| 7120 | .count = 2, |
| 7121 | .info = alc883_mux_enum_info, |
| 7122 | .get = alc883_mux_enum_get, |
| 7123 | .put = alc883_mux_enum_put, |
| 7124 | }, |
| 7125 | { } /* end */ |
| 7126 | }; |
| 7127 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7128 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7129 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7130 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7131 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7132 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7133 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7134 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7135 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7137 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7138 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7139 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7140 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7141 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7142 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7143 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7144 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7145 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7146 | { |
| 7147 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7148 | /* .name = "Capture Source", */ |
| 7149 | .name = "Input Source", |
| 7150 | .count = 2, |
| 7151 | .info = alc883_mux_enum_info, |
| 7152 | .get = alc883_mux_enum_get, |
| 7153 | .put = alc883_mux_enum_put, |
| 7154 | }, |
| 7155 | { } /* end */ |
| 7156 | }; |
| 7157 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7158 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7159 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7160 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7161 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7162 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7163 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7164 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7165 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7166 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7167 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7168 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7169 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7170 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7171 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7172 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7173 | { |
| 7174 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7175 | /* .name = "Capture Source", */ |
| 7176 | .name = "Input Source", |
| 7177 | .count = 2, |
| 7178 | .info = alc883_mux_enum_info, |
| 7179 | .get = alc883_mux_enum_get, |
| 7180 | .put = alc883_mux_enum_put, |
| 7181 | }, |
| 7182 | { } /* end */ |
| 7183 | }; |
| 7184 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7185 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7186 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7187 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7188 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7189 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7190 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7191 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7192 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7193 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7194 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7195 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7196 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7197 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7198 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7199 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7200 | { |
| 7201 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7202 | /* .name = "Capture Source", */ |
| 7203 | .name = "Input Source", |
| 7204 | .count = 2, |
| 7205 | .info = alc883_mux_enum_info, |
| 7206 | .get = alc883_mux_enum_get, |
| 7207 | .put = alc883_mux_enum_put, |
| 7208 | }, |
| 7209 | { } /* end */ |
| 7210 | }; |
| 7211 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7212 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7213 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7214 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7215 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7216 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7217 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7218 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7219 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7220 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7221 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7223 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7224 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7225 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7226 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7227 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7228 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7229 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7230 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7231 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7232 | { |
| 7233 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7234 | /* .name = "Capture Source", */ |
| 7235 | .name = "Input Source", |
| 7236 | .count = 2, |
| 7237 | .info = alc883_mux_enum_info, |
| 7238 | .get = alc883_mux_enum_get, |
| 7239 | .put = alc883_mux_enum_put, |
| 7240 | }, |
| 7241 | { } /* end */ |
| 7242 | }; |
| 7243 | |
| 7244 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7245 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7246 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7247 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7248 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7249 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7250 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7251 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7252 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7253 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7254 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7255 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7256 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7257 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7258 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7259 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7260 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7261 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7262 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7263 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7264 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7265 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7266 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7267 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7268 | { |
| 7269 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7270 | /* .name = "Capture Source", */ |
| 7271 | .name = "Input Source", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7272 | .count = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7273 | .info = alc883_mux_enum_info, |
| 7274 | .get = alc883_mux_enum_get, |
| 7275 | .put = alc883_mux_enum_put, |
| 7276 | }, |
| 7277 | { } /* end */ |
| 7278 | }; |
| 7279 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7280 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7281 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7282 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7283 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7284 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7285 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7286 | HDA_OUTPUT), |
| 7287 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7288 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7289 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7290 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7291 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7292 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7293 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7294 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7295 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7296 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7297 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7298 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7299 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7300 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7301 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7302 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7303 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7304 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7305 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7306 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7307 | { |
| 7308 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7309 | /* .name = "Capture Source", */ |
| 7310 | .name = "Input Source", |
| 7311 | .count = 2, |
| 7312 | .info = alc883_mux_enum_info, |
| 7313 | .get = alc883_mux_enum_get, |
| 7314 | .put = alc883_mux_enum_put, |
| 7315 | }, |
| 7316 | { } /* end */ |
| 7317 | }; |
| 7318 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7319 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7320 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7321 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7322 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7323 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7324 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7325 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7326 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7327 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7328 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7329 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7330 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7331 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7332 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7333 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7334 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7336 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7337 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7338 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7339 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7340 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7341 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7342 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7343 | |
| 7344 | { |
| 7345 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7346 | /* .name = "Capture Source", */ |
| 7347 | .name = "Input Source", |
| 7348 | .count = 1, |
| 7349 | .info = alc883_mux_enum_info, |
| 7350 | .get = alc883_mux_enum_get, |
| 7351 | .put = alc883_mux_enum_put, |
| 7352 | }, |
| 7353 | { } /* end */ |
| 7354 | }; |
| 7355 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7356 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7357 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7358 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7359 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7360 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7361 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7362 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7363 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7364 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7365 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7366 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7367 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7368 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7369 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7370 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7371 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7372 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7373 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7374 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7375 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7376 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7377 | { |
| 7378 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7379 | /* .name = "Capture Source", */ |
| 7380 | .name = "Input Source", |
| 7381 | .count = 2, |
| 7382 | .info = alc883_mux_enum_info, |
| 7383 | .get = alc883_mux_enum_get, |
| 7384 | .put = alc883_mux_enum_put, |
| 7385 | }, |
| 7386 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7387 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7388 | |
| 7389 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7390 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7391 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7392 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7393 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7394 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7395 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7396 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7397 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7398 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7399 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7400 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7401 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7402 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7403 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7404 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7405 | { |
| 7406 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7407 | /* .name = "Capture Source", */ |
| 7408 | .name = "Input Source", |
| 7409 | .count = 2, |
| 7410 | .info = alc883_mux_enum_info, |
| 7411 | .get = alc883_mux_enum_get, |
| 7412 | .put = alc883_mux_enum_put, |
| 7413 | }, |
| 7414 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7415 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7416 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7417 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7418 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7419 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7420 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7421 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7422 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7423 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7424 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7425 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7426 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7427 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7428 | { |
| 7429 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7430 | /* .name = "Capture Source", */ |
| 7431 | .name = "Input Source", |
| 7432 | .count = 1, |
| 7433 | .info = alc883_mux_enum_info, |
| 7434 | .get = alc883_mux_enum_get, |
| 7435 | .put = alc883_mux_enum_put, |
| 7436 | }, |
| 7437 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7438 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7439 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7440 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7441 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7442 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7443 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7444 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7445 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7446 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7447 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7448 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7449 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7450 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7451 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7452 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7453 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7454 | { |
| 7455 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7456 | /* .name = "Capture Source", */ |
| 7457 | .name = "Input Source", |
| 7458 | .count = 2, |
| 7459 | .info = alc883_mux_enum_info, |
| 7460 | .get = alc883_mux_enum_get, |
| 7461 | .put = alc883_mux_enum_put, |
| 7462 | }, |
| 7463 | { } /* end */ |
| 7464 | }; |
| 7465 | |
| 7466 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7467 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7468 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7469 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7470 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7471 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7472 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7473 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7474 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7475 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7476 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7477 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7478 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7479 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7480 | { |
| 7481 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7482 | /* .name = "Capture Source", */ |
| 7483 | .name = "Input Source", |
| 7484 | .count = 2, |
| 7485 | .info = alc883_mux_enum_info, |
| 7486 | .get = alc883_mux_enum_get, |
| 7487 | .put = alc883_mux_enum_put, |
| 7488 | }, |
| 7489 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7490 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7491 | |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7492 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7493 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7494 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7495 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7496 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7497 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7498 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7499 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7500 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7501 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7502 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7503 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7504 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7505 | { |
| 7506 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7507 | /* .name = "Capture Source", */ |
| 7508 | .name = "Input Source", |
| 7509 | .count = 2, |
| 7510 | .info = alc883_mux_enum_info, |
| 7511 | .get = alc883_mux_enum_get, |
| 7512 | .put = alc883_mux_enum_put, |
| 7513 | }, |
| 7514 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7515 | }; |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7516 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7517 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7518 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7519 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7520 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7521 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7522 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7523 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7524 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7525 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7526 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7527 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7528 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7529 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7530 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7531 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7532 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7533 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7534 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7535 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7536 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7537 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7538 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7539 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7540 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7541 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7542 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7543 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7544 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7545 | { |
| 7546 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7547 | /* .name = "Capture Source", */ |
| 7548 | .name = "Input Source", |
| 7549 | .count = 2, |
| 7550 | .info = alc883_mux_enum_info, |
| 7551 | .get = alc883_mux_enum_get, |
| 7552 | .put = alc883_mux_enum_put, |
| 7553 | }, |
| 7554 | { } /* end */ |
| 7555 | }; |
| 7556 | |
| 7557 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7558 | .ops = &snd_hda_bind_vol, |
| 7559 | .values = { |
| 7560 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7561 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7562 | 0 |
| 7563 | }, |
| 7564 | }; |
| 7565 | |
| 7566 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7567 | .ops = &snd_hda_bind_sw, |
| 7568 | .values = { |
| 7569 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7570 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7571 | 0 |
| 7572 | }, |
| 7573 | }; |
| 7574 | |
| 7575 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7576 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7577 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7578 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7579 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7580 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7581 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7582 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7583 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7584 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7585 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7586 | { |
| 7587 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7588 | /* .name = "Capture Source", */ |
| 7589 | .name = "Input Source", |
| 7590 | .count = 1, |
| 7591 | .info = alc883_mux_enum_info, |
| 7592 | .get = alc883_mux_enum_get, |
| 7593 | .put = alc883_mux_enum_put, |
| 7594 | }, |
| 7595 | { } /* end */ |
| 7596 | }; |
| 7597 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7598 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7599 | { |
| 7600 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7601 | .name = "Channel Mode", |
| 7602 | .info = alc_ch_mode_info, |
| 7603 | .get = alc_ch_mode_get, |
| 7604 | .put = alc_ch_mode_put, |
| 7605 | }, |
| 7606 | { } /* end */ |
| 7607 | }; |
| 7608 | |
| 7609 | static struct hda_verb alc883_init_verbs[] = { |
| 7610 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7611 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7612 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7613 | /* ADC2: mute amp left and right */ |
| 7614 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7615 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7616 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7618 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7619 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7620 | /* Rear mixer */ |
| 7621 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7622 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7623 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7624 | /* CLFE mixer */ |
| 7625 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7626 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7627 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7628 | /* Side mixer */ |
| 7629 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7630 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7631 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7632 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7633 | /* mute analog input loopbacks */ |
| 7634 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7635 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7636 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7637 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7638 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7639 | |
| 7640 | /* Front Pin: output 0 (0x0c) */ |
| 7641 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7642 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7643 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7644 | /* Rear Pin: output 1 (0x0d) */ |
| 7645 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7646 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7647 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7648 | /* CLFE Pin: output 2 (0x0e) */ |
| 7649 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7650 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7651 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7652 | /* Side Pin: output 3 (0x0f) */ |
| 7653 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7654 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7655 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7656 | /* Mic (rear) pin: input vref at 80% */ |
| 7657 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7658 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7659 | /* Front Mic pin: input vref at 80% */ |
| 7660 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7661 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7662 | /* Line In pin: input */ |
| 7663 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7664 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7665 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7666 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7667 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7668 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7669 | /* CD pin widget for input */ |
| 7670 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7671 | |
| 7672 | /* FIXME: use matrix-type input source selection */ |
| 7673 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7674 | /* Input mixer2 */ |
| 7675 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7676 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7677 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7678 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7679 | /* Input mixer3 */ |
| 7680 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7681 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7682 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7683 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7684 | { } |
| 7685 | }; |
| 7686 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7687 | /* toggle speaker-output according to the hp-jack state */ |
| 7688 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7689 | { |
| 7690 | unsigned int present; |
| 7691 | |
| 7692 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7693 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7694 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7695 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7696 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7697 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7698 | } |
| 7699 | |
| 7700 | /* auto-toggle front mic */ |
| 7701 | /* |
| 7702 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7703 | { |
| 7704 | unsigned int present; |
| 7705 | unsigned char bits; |
| 7706 | |
| 7707 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7708 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7709 | bits = present ? HDA_AMP_MUTE : 0; |
| 7710 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7711 | } |
| 7712 | */ |
| 7713 | |
| 7714 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7715 | { |
| 7716 | alc883_mitac_hp_automute(codec); |
| 7717 | /* alc883_mitac_mic_automute(codec); */ |
| 7718 | } |
| 7719 | |
| 7720 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7721 | unsigned int res) |
| 7722 | { |
| 7723 | switch (res >> 26) { |
| 7724 | case ALC880_HP_EVENT: |
| 7725 | alc883_mitac_hp_automute(codec); |
| 7726 | break; |
| 7727 | case ALC880_MIC_EVENT: |
| 7728 | /* alc883_mitac_mic_automute(codec); */ |
| 7729 | break; |
| 7730 | } |
| 7731 | } |
| 7732 | |
| 7733 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7734 | /* HP */ |
| 7735 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7736 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7737 | /* Subwoofer */ |
| 7738 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7739 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7740 | |
| 7741 | /* enable unsolicited event */ |
| 7742 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7743 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7744 | |
| 7745 | { } /* end */ |
| 7746 | }; |
| 7747 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7748 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7749 | /* HP */ |
| 7750 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7751 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7752 | /* Int speaker */ |
| 7753 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7754 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7755 | |
| 7756 | /* enable unsolicited event */ |
| 7757 | {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] | 7758 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7759 | |
| 7760 | { } /* end */ |
| 7761 | }; |
| 7762 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7763 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7764 | /* HP */ |
| 7765 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7766 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7767 | /* Subwoofer */ |
| 7768 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7769 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7770 | |
| 7771 | /* enable unsolicited event */ |
| 7772 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7773 | |
| 7774 | { } /* end */ |
| 7775 | }; |
| 7776 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7777 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7778 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7779 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7780 | |
| 7781 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7782 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7783 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7784 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7785 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7786 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7787 | |
| 7788 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7789 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7790 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7791 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7792 | |
| 7793 | { } /* end */ |
| 7794 | }; |
| 7795 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7796 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7797 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7798 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7799 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7800 | { } /* end */ |
| 7801 | }; |
| 7802 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7803 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7804 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7805 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7806 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7807 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7808 | { } /* end */ |
| 7809 | }; |
| 7810 | |
| 7811 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7812 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7813 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7814 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7815 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7816 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7817 | { } /* end */ |
| 7818 | }; |
| 7819 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7820 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7821 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7822 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7823 | |
| 7824 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7825 | |
| 7826 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7827 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7828 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7829 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7830 | { } /* end */ |
| 7831 | }; |
| 7832 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7833 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 7834 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7835 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7836 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7837 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7838 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7839 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7840 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7841 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7842 | { } /* end */ |
| 7843 | }; |
| 7844 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7845 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7846 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7847 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7848 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7849 | { } |
| 7850 | }; |
| 7851 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7852 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7853 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7854 | { } |
| 7855 | }; |
| 7856 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7857 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7858 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7859 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7860 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7861 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7862 | { } |
| 7863 | }; |
| 7864 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7865 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7866 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7867 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7868 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7869 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7870 | { } |
| 7871 | }; |
| 7872 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7873 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7874 | { 2, alc888_3st_hp_2ch_init }, |
| 7875 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7876 | }; |
| 7877 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7878 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7879 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7880 | { |
| 7881 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7882 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7883 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7884 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7885 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7886 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7887 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7888 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7889 | } |
| 7890 | |
| 7891 | /* toggle RCA according to the front-jack state */ |
| 7892 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7893 | { |
| 7894 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7895 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7896 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7897 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7898 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7899 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7900 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7901 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7902 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7903 | unsigned int res) |
| 7904 | { |
| 7905 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7906 | alc888_lenovo_ms7195_front_automute(codec); |
| 7907 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7908 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7909 | } |
| 7910 | |
| 7911 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7912 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7913 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7914 | |
| 7915 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7916 | |
| 7917 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7918 | { } /* end */ |
| 7919 | }; |
| 7920 | |
| 7921 | /* toggle speaker-output according to the hp-jack state */ |
| 7922 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7923 | { |
| 7924 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7925 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7926 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7927 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7928 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7929 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7930 | } |
| 7931 | |
| 7932 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7933 | unsigned int res) |
| 7934 | { |
| 7935 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7936 | alc883_medion_md2_automute(codec); |
| 7937 | } |
| 7938 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7939 | /* toggle speaker-output according to the hp-jack state */ |
| 7940 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7941 | { |
| 7942 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7943 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7944 | |
| 7945 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7946 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7947 | bits = present ? HDA_AMP_MUTE : 0; |
| 7948 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7949 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7950 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7951 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7952 | } |
| 7953 | |
| 7954 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7955 | { |
| 7956 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7957 | alc883_tagra_automute(codec); |
| 7958 | } |
| 7959 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7960 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7961 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7962 | { |
| 7963 | unsigned int present; |
| 7964 | unsigned char bits; |
| 7965 | |
| 7966 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7967 | & AC_PINSENSE_PRESENCE; |
| 7968 | bits = present ? HDA_AMP_MUTE : 0; |
| 7969 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7970 | HDA_AMP_MUTE, bits); |
| 7971 | } |
| 7972 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7973 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7974 | { |
| 7975 | unsigned int present; |
| 7976 | |
| 7977 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7978 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7979 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7980 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7981 | } |
| 7982 | |
| 7983 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7984 | { |
| 7985 | alc883_clevo_m720_hp_automute(codec); |
| 7986 | alc883_clevo_m720_mic_automute(codec); |
| 7987 | } |
| 7988 | |
| 7989 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7990 | unsigned int res) |
| 7991 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7992 | switch (res >> 26) { |
| 7993 | case ALC880_HP_EVENT: |
| 7994 | alc883_clevo_m720_hp_automute(codec); |
| 7995 | break; |
| 7996 | case ALC880_MIC_EVENT: |
| 7997 | alc883_clevo_m720_mic_automute(codec); |
| 7998 | break; |
| 7999 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8000 | } |
| 8001 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8002 | /* toggle speaker-output according to the hp-jack state */ |
| 8003 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 8004 | { |
| 8005 | unsigned int present; |
| 8006 | unsigned char bits; |
| 8007 | |
| 8008 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8009 | & AC_PINSENSE_PRESENCE; |
| 8010 | bits = present ? HDA_AMP_MUTE : 0; |
| 8011 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8012 | HDA_AMP_MUTE, bits); |
| 8013 | } |
| 8014 | |
| 8015 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 8016 | unsigned int res) |
| 8017 | { |
| 8018 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8019 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 8020 | } |
| 8021 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8022 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 8023 | { |
| 8024 | unsigned int present; |
| 8025 | unsigned char bits; |
| 8026 | |
| 8027 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8028 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8029 | bits = present ? 0x80 : 0; |
| 8030 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8031 | 0x80, bits); |
| 8032 | } |
| 8033 | |
| 8034 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 8035 | unsigned int res) |
| 8036 | { |
| 8037 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8038 | alc883_haier_w66_automute(codec); |
| 8039 | } |
| 8040 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8041 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8042 | { |
| 8043 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8044 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8045 | |
| 8046 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8047 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8048 | bits = present ? HDA_AMP_MUTE : 0; |
| 8049 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8050 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8051 | } |
| 8052 | |
| 8053 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8054 | { |
| 8055 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8056 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8057 | |
| 8058 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8059 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8060 | bits = present ? HDA_AMP_MUTE : 0; |
| 8061 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8062 | HDA_AMP_MUTE, bits); |
| 8063 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8064 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8065 | } |
| 8066 | |
| 8067 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8068 | unsigned int res) |
| 8069 | { |
| 8070 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8071 | alc883_lenovo_101e_all_automute(codec); |
| 8072 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8073 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8074 | } |
| 8075 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8076 | /* toggle speaker-output according to the hp-jack state */ |
| 8077 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 8078 | { |
| 8079 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8080 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8081 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8082 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8083 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8084 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8085 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8086 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8087 | } |
| 8088 | |
| 8089 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 8090 | unsigned int res) |
| 8091 | { |
| 8092 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8093 | alc883_acer_aspire_automute(codec); |
| 8094 | } |
| 8095 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8096 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8097 | /* HP Pin: output 0 (0x0c) */ |
| 8098 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8099 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8100 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8101 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8102 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8103 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8104 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8105 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8106 | /* eanable EAPD on medion laptop */ |
| 8107 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8108 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8109 | /* enable unsolicited event */ |
| 8110 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8111 | { } |
| 8112 | }; |
| 8113 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8114 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 8115 | { |
| 8116 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8117 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8118 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8119 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8120 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8121 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8122 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8123 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8124 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8125 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8126 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8127 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8128 | } |
| 8129 | |
| 8130 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 8131 | unsigned int res) |
| 8132 | { |
| 8133 | switch (res >> 26) { |
| 8134 | case ALC880_HP_EVENT: |
| 8135 | printk("hp_event\n"); |
| 8136 | alc888_6st_dell_front_automute(codec); |
| 8137 | break; |
| 8138 | } |
| 8139 | } |
| 8140 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8141 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 8142 | { |
| 8143 | unsigned int mute; |
| 8144 | unsigned int present; |
| 8145 | |
| 8146 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8147 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8148 | AC_VERB_GET_PIN_SENSE, 0); |
| 8149 | present = (present & 0x80000000) != 0; |
| 8150 | if (present) { |
| 8151 | /* mute internal speaker */ |
| 8152 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8153 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8154 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8155 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8156 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8157 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8158 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8159 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8160 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8161 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8162 | } else { |
| 8163 | /* unmute internal speaker if necessary */ |
| 8164 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8165 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8166 | HDA_AMP_MUTE, mute); |
| 8167 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8168 | HDA_AMP_MUTE, mute); |
| 8169 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8170 | HDA_AMP_MUTE, mute); |
| 8171 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8172 | HDA_AMP_MUTE, mute); |
| 8173 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8174 | HDA_AMP_MUTE, mute); |
| 8175 | } |
| 8176 | } |
| 8177 | |
| 8178 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 8179 | unsigned int res) |
| 8180 | { |
| 8181 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8182 | alc888_lenovo_sky_front_automute(codec); |
| 8183 | } |
| 8184 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8185 | /* |
| 8186 | * generic initialization of ADC, input mixers and output mixers |
| 8187 | */ |
| 8188 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8189 | /* |
| 8190 | * Unmute ADC0-2 and set the default input to mic-in |
| 8191 | */ |
| 8192 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8193 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8194 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8195 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8196 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8197 | /* 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] | 8198 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8199 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8200 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8201 | */ |
| 8202 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8203 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8204 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8205 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8206 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8207 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8208 | |
| 8209 | /* |
| 8210 | * Set up output mixers (0x0c - 0x0f) |
| 8211 | */ |
| 8212 | /* set vol=0 to output mixers */ |
| 8213 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8214 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8215 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8216 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8217 | /* set up input amps for analog loopback */ |
| 8218 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8219 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8220 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8221 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8222 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8223 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8224 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8225 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8226 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8227 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8228 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8229 | |
| 8230 | /* FIXME: use matrix-type input source selection */ |
| 8231 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8232 | /* Input mixer1 */ |
| 8233 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8234 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8235 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8236 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8237 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8238 | /* Input mixer2 */ |
| 8239 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8240 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8241 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8242 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8243 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8244 | |
| 8245 | { } |
| 8246 | }; |
| 8247 | |
| 8248 | /* capture mixer elements */ |
| 8249 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 8250 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8251 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8252 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 8253 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 8254 | { |
| 8255 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8256 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8257 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8258 | */ |
| 8259 | /* .name = "Capture Source", */ |
| 8260 | .name = "Input Source", |
| 8261 | .count = 2, |
| 8262 | .info = alc882_mux_enum_info, |
| 8263 | .get = alc882_mux_enum_get, |
| 8264 | .put = alc882_mux_enum_put, |
| 8265 | }, |
| 8266 | { } /* end */ |
| 8267 | }; |
| 8268 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8269 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8270 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8271 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8272 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8273 | /* enable unsolicited event */ |
| 8274 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8275 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8276 | { } /* end */ |
| 8277 | }; |
| 8278 | |
| 8279 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8280 | { |
| 8281 | unsigned int present; |
| 8282 | |
| 8283 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8284 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8285 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8286 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8287 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8288 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8289 | } |
| 8290 | |
| 8291 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8292 | { |
| 8293 | unsigned int present; |
| 8294 | unsigned char bits; |
| 8295 | |
| 8296 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8297 | AC_VERB_GET_PIN_SENSE, 0) |
| 8298 | & AC_PINSENSE_PRESENCE; |
| 8299 | bits = present ? 0 : PIN_OUT; |
| 8300 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8301 | bits); |
| 8302 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8303 | bits); |
| 8304 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8305 | bits); |
| 8306 | } |
| 8307 | |
| 8308 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8309 | unsigned int res) |
| 8310 | { |
| 8311 | switch (res >> 26) { |
| 8312 | case ALC880_HP_EVENT: |
| 8313 | alc883_M90V_speaker_automute(codec); |
| 8314 | break; |
| 8315 | case ALC880_MIC_EVENT: |
| 8316 | alc883_nb_mic_automute(codec); |
| 8317 | break; |
| 8318 | } |
| 8319 | } |
| 8320 | |
| 8321 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8322 | { |
| 8323 | alc883_M90V_speaker_automute(codec); |
| 8324 | alc883_nb_mic_automute(codec); |
| 8325 | } |
| 8326 | |
| 8327 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8328 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8329 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8330 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8331 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8332 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8333 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8334 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8335 | /* enable unsolicited event */ |
| 8336 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8337 | { } /* end */ |
| 8338 | }; |
| 8339 | |
| 8340 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8341 | { |
| 8342 | unsigned int present; |
| 8343 | unsigned char bits; |
| 8344 | |
| 8345 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8346 | AC_VERB_GET_PIN_SENSE, 0) |
| 8347 | & AC_PINSENSE_PRESENCE; |
| 8348 | bits = present ? 0 : PIN_OUT; |
| 8349 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8350 | bits); |
| 8351 | } |
| 8352 | |
| 8353 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8354 | unsigned int res) |
| 8355 | { |
| 8356 | switch (res >> 26) { |
| 8357 | case ALC880_HP_EVENT: |
| 8358 | alc883_eee1601_speaker_automute(codec); |
| 8359 | break; |
| 8360 | } |
| 8361 | } |
| 8362 | |
| 8363 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8364 | { |
| 8365 | alc883_eee1601_speaker_automute(codec); |
| 8366 | } |
| 8367 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8368 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8369 | #define alc883_loopbacks alc880_loopbacks |
| 8370 | #endif |
| 8371 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8372 | /* pcm configuration: identiacal with ALC880 */ |
| 8373 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8374 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8375 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8376 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8377 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8378 | |
| 8379 | /* |
| 8380 | * configuration and preset |
| 8381 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8382 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8383 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8384 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8385 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8386 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8387 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8388 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8389 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8390 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8391 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8392 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8393 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8394 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8395 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8396 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8397 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8398 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8399 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8400 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8401 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8402 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8403 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8404 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8405 | [ALC883_AUTO] = "auto", |
| 8406 | }; |
| 8407 | |
| 8408 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8409 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8410 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 8411 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8412 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8413 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8414 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8415 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8416 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8417 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8418 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8419 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8420 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8421 | 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] | 8422 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8423 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8424 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8425 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8426 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8427 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8428 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8429 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8430 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8431 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8432 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8433 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8434 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8435 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8436 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8437 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8438 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8439 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8440 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8441 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8442 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8443 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8444 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8445 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8446 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8447 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8448 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8449 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8450 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8451 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8452 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8453 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8454 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8455 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8456 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8457 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8458 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8459 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8460 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8461 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8462 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8463 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8464 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8465 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8466 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8467 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8468 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8469 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8470 | {} |
| 8471 | }; |
| 8472 | |
| 8473 | static struct alc_config_preset alc883_presets[] = { |
| 8474 | [ALC883_3ST_2ch_DIG] = { |
| 8475 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8476 | .init_verbs = { alc883_init_verbs }, |
| 8477 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8478 | .dac_nids = alc883_dac_nids, |
| 8479 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8480 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8481 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8482 | .channel_mode = alc883_3ST_2ch_modes, |
| 8483 | .input_mux = &alc883_capture_source, |
| 8484 | }, |
| 8485 | [ALC883_3ST_6ch_DIG] = { |
| 8486 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8487 | .init_verbs = { alc883_init_verbs }, |
| 8488 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8489 | .dac_nids = alc883_dac_nids, |
| 8490 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8491 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8492 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8493 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8494 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8495 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8496 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8497 | [ALC883_3ST_6ch] = { |
| 8498 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8499 | .init_verbs = { alc883_init_verbs }, |
| 8500 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8501 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8502 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8503 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8504 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8505 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8506 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8507 | [ALC883_3ST_6ch_INTEL] = { |
| 8508 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8509 | .init_verbs = { alc883_init_verbs }, |
| 8510 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8511 | .dac_nids = alc883_dac_nids, |
| 8512 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8513 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8514 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8515 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8516 | .need_dac_fix = 1, |
| 8517 | .input_mux = &alc883_3stack_6ch_intel, |
| 8518 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8519 | [ALC883_6ST_DIG] = { |
| 8520 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8521 | .init_verbs = { alc883_init_verbs }, |
| 8522 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8523 | .dac_nids = alc883_dac_nids, |
| 8524 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8525 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8526 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8527 | .channel_mode = alc883_sixstack_modes, |
| 8528 | .input_mux = &alc883_capture_source, |
| 8529 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8530 | [ALC883_TARGA_DIG] = { |
| 8531 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8532 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8533 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8534 | .dac_nids = alc883_dac_nids, |
| 8535 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8536 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8537 | .channel_mode = alc883_3ST_6ch_modes, |
| 8538 | .need_dac_fix = 1, |
| 8539 | .input_mux = &alc883_capture_source, |
| 8540 | .unsol_event = alc883_tagra_unsol_event, |
| 8541 | .init_hook = alc883_tagra_automute, |
| 8542 | }, |
| 8543 | [ALC883_TARGA_2ch_DIG] = { |
| 8544 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8545 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8546 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8547 | .dac_nids = alc883_dac_nids, |
| 8548 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8549 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8550 | .channel_mode = alc883_3ST_2ch_modes, |
| 8551 | .input_mux = &alc883_capture_source, |
| 8552 | .unsol_event = alc883_tagra_unsol_event, |
| 8553 | .init_hook = alc883_tagra_automute, |
| 8554 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8555 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8556 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8557 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8558 | * and the headphone jack. Turn this on and rely on the |
| 8559 | * standard mute methods whenever the user wants to turn |
| 8560 | * these outputs off. |
| 8561 | */ |
| 8562 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8563 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8564 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8565 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8566 | .channel_mode = alc883_3ST_2ch_modes, |
| 8567 | .input_mux = &alc883_capture_source, |
| 8568 | }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8569 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8570 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8571 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8572 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8573 | .dac_nids = alc883_dac_nids, |
| 8574 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8575 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8576 | .channel_mode = alc883_3ST_2ch_modes, |
| 8577 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8578 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8579 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8580 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8581 | [ALC883_MEDION] = { |
| 8582 | .mixers = { alc883_fivestack_mixer, |
| 8583 | alc883_chmode_mixer }, |
| 8584 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8585 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8586 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8587 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8588 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8589 | .channel_mode = alc883_sixstack_modes, |
| 8590 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8591 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8592 | [ALC883_MEDION_MD2] = { |
| 8593 | .mixers = { alc883_medion_md2_mixer}, |
| 8594 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8595 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8596 | .dac_nids = alc883_dac_nids, |
| 8597 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8598 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8599 | .channel_mode = alc883_3ST_2ch_modes, |
| 8600 | .input_mux = &alc883_capture_source, |
| 8601 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8602 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8603 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8604 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8605 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8606 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8607 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8608 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8609 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8610 | .channel_mode = alc883_3ST_2ch_modes, |
| 8611 | .input_mux = &alc883_capture_source, |
| 8612 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8613 | [ALC883_CLEVO_M720] = { |
| 8614 | .mixers = { alc883_clevo_m720_mixer }, |
| 8615 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8616 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8617 | .dac_nids = alc883_dac_nids, |
| 8618 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8619 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8620 | .channel_mode = alc883_3ST_2ch_modes, |
| 8621 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8622 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8623 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8624 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8625 | [ALC883_LENOVO_101E_2ch] = { |
| 8626 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8627 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8628 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8629 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8630 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8631 | .channel_mode = alc883_3ST_2ch_modes, |
| 8632 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8633 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8634 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8635 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8636 | [ALC883_LENOVO_NB0763] = { |
| 8637 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8638 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8639 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8640 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8641 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8642 | .channel_mode = alc883_3ST_2ch_modes, |
| 8643 | .need_dac_fix = 1, |
| 8644 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8645 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8646 | .init_hook = alc883_medion_md2_automute, |
| 8647 | }, |
| 8648 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8649 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8650 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8651 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8652 | .dac_nids = alc883_dac_nids, |
| 8653 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8654 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8655 | .channel_mode = alc883_3ST_6ch_modes, |
| 8656 | .need_dac_fix = 1, |
| 8657 | .input_mux = &alc883_capture_source, |
| 8658 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8659 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8660 | }, |
| 8661 | [ALC883_HAIER_W66] = { |
| 8662 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8663 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8664 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8665 | .dac_nids = alc883_dac_nids, |
| 8666 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8667 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8668 | .channel_mode = alc883_3ST_2ch_modes, |
| 8669 | .input_mux = &alc883_capture_source, |
| 8670 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8671 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8672 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8673 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8674 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8675 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8676 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8677 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8678 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8679 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8680 | .need_dac_fix = 1, |
| 8681 | .input_mux = &alc883_capture_source, |
| 8682 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8683 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8684 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8685 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8686 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8687 | .dac_nids = alc883_dac_nids, |
| 8688 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8689 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8690 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8691 | .channel_mode = alc883_sixstack_modes, |
| 8692 | .input_mux = &alc883_capture_source, |
| 8693 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8694 | .init_hook = alc888_6st_dell_front_automute, |
| 8695 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8696 | [ALC883_MITAC] = { |
| 8697 | .mixers = { alc883_mitac_mixer }, |
| 8698 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8699 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8700 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8701 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8702 | .channel_mode = alc883_3ST_2ch_modes, |
| 8703 | .input_mux = &alc883_capture_source, |
| 8704 | .unsol_event = alc883_mitac_unsol_event, |
| 8705 | .init_hook = alc883_mitac_automute, |
| 8706 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8707 | [ALC883_FUJITSU_PI2515] = { |
| 8708 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8709 | .init_verbs = { alc883_init_verbs, |
| 8710 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8711 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8712 | .dac_nids = alc883_dac_nids, |
| 8713 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8714 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8715 | .channel_mode = alc883_3ST_2ch_modes, |
| 8716 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8717 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8718 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8719 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8720 | [ALC888_LENOVO_SKY] = { |
| 8721 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 8722 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 8723 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8724 | .dac_nids = alc883_dac_nids, |
| 8725 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8726 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 8727 | .adc_nids = alc883_adc_nids, |
| 8728 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8729 | .channel_mode = alc883_sixstack_modes, |
| 8730 | .need_dac_fix = 1, |
| 8731 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 8732 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 8733 | .init_hook = alc888_lenovo_sky_front_automute, |
| 8734 | }, |
| 8735 | [ALC888_ASUS_M90V] = { |
| 8736 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8737 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 8738 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8739 | .dac_nids = alc883_dac_nids, |
| 8740 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8741 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8742 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8743 | .channel_mode = alc883_3ST_6ch_modes, |
| 8744 | .need_dac_fix = 1, |
| 8745 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8746 | .unsol_event = alc883_mode2_unsol_event, |
| 8747 | .init_hook = alc883_mode2_inithook, |
| 8748 | }, |
| 8749 | [ALC888_ASUS_EEE1601] = { |
| 8750 | .mixers = { alc883_asus_eee1601_mixer }, |
| 8751 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 8752 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8753 | .dac_nids = alc883_dac_nids, |
| 8754 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8755 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8756 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8757 | .channel_mode = alc883_3ST_2ch_modes, |
| 8758 | .need_dac_fix = 1, |
| 8759 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 8760 | .unsol_event = alc883_eee1601_unsol_event, |
| 8761 | .init_hook = alc883_eee1601_inithook, |
| 8762 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8763 | }; |
| 8764 | |
| 8765 | |
| 8766 | /* |
| 8767 | * BIOS auto configuration |
| 8768 | */ |
| 8769 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8770 | hda_nid_t nid, int pin_type, |
| 8771 | int dac_idx) |
| 8772 | { |
| 8773 | /* set as output */ |
| 8774 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8775 | int idx; |
| 8776 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8777 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8778 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8779 | idx = 4; |
| 8780 | else |
| 8781 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8782 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8783 | |
| 8784 | } |
| 8785 | |
| 8786 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8787 | { |
| 8788 | struct alc_spec *spec = codec->spec; |
| 8789 | int i; |
| 8790 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8791 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8792 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8793 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8794 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8795 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8796 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8797 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8798 | } |
| 8799 | } |
| 8800 | |
| 8801 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8802 | { |
| 8803 | struct alc_spec *spec = codec->spec; |
| 8804 | hda_nid_t pin; |
| 8805 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8806 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8807 | if (pin) /* connect to front */ |
| 8808 | /* use dac 0 */ |
| 8809 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8810 | pin = spec->autocfg.speaker_pins[0]; |
| 8811 | if (pin) |
| 8812 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8813 | } |
| 8814 | |
| 8815 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8816 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8817 | |
| 8818 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8819 | { |
| 8820 | struct alc_spec *spec = codec->spec; |
| 8821 | int i; |
| 8822 | |
| 8823 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8824 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8825 | if (alc883_is_input_pin(nid)) { |
| 8826 | snd_hda_codec_write(codec, nid, 0, |
| 8827 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8828 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8829 | PIN_VREF80 : PIN_IN)); |
| 8830 | if (nid != ALC883_PIN_CD_NID) |
| 8831 | snd_hda_codec_write(codec, nid, 0, |
| 8832 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8833 | AMP_OUT_MUTE); |
| 8834 | } |
| 8835 | } |
| 8836 | } |
| 8837 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8838 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 8839 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8840 | /* almost identical with ALC880 parser... */ |
| 8841 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8842 | { |
| 8843 | struct alc_spec *spec = codec->spec; |
| 8844 | int err = alc880_parse_auto_config(codec); |
| 8845 | |
| 8846 | if (err < 0) |
| 8847 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8848 | else if (!err) |
| 8849 | return 0; /* no config found */ |
| 8850 | |
| 8851 | err = alc_auto_add_mic_boost(codec); |
| 8852 | if (err < 0) |
| 8853 | return err; |
| 8854 | |
| 8855 | /* hack - override the init verbs */ |
| 8856 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8857 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8858 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8859 | |
| 8860 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8861 | } |
| 8862 | |
| 8863 | /* additional initialization for auto-configuration model */ |
| 8864 | static void alc883_auto_init(struct hda_codec *codec) |
| 8865 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8866 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8867 | alc883_auto_init_multi_out(codec); |
| 8868 | alc883_auto_init_hp_out(codec); |
| 8869 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8870 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8871 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 8872 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8873 | } |
| 8874 | |
| 8875 | static int patch_alc883(struct hda_codec *codec) |
| 8876 | { |
| 8877 | struct alc_spec *spec; |
| 8878 | int err, board_config; |
| 8879 | |
| 8880 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8881 | if (spec == NULL) |
| 8882 | return -ENOMEM; |
| 8883 | |
| 8884 | codec->spec = spec; |
| 8885 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 8886 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 8887 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8888 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8889 | alc883_models, |
| 8890 | alc883_cfg_tbl); |
| 8891 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8892 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8893 | "trying auto-probe from BIOS...\n"); |
| 8894 | board_config = ALC883_AUTO; |
| 8895 | } |
| 8896 | |
| 8897 | if (board_config == ALC883_AUTO) { |
| 8898 | /* automatic parse from the BIOS config */ |
| 8899 | err = alc883_parse_auto_config(codec); |
| 8900 | if (err < 0) { |
| 8901 | alc_free(codec); |
| 8902 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8903 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8904 | printk(KERN_INFO |
| 8905 | "hda_codec: Cannot set up configuration " |
| 8906 | "from BIOS. Using base mode...\n"); |
| 8907 | board_config = ALC883_3ST_2ch_DIG; |
| 8908 | } |
| 8909 | } |
| 8910 | |
| 8911 | if (board_config != ALC883_AUTO) |
| 8912 | setup_preset(spec, &alc883_presets[board_config]); |
| 8913 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8914 | switch (codec->vendor_id) { |
| 8915 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 8916 | if (codec->revision_id == 0x100101) { |
| 8917 | spec->stream_name_analog = "ALC1200 Analog"; |
| 8918 | spec->stream_name_digital = "ALC1200 Digital"; |
| 8919 | } else { |
| 8920 | spec->stream_name_analog = "ALC888 Analog"; |
| 8921 | spec->stream_name_digital = "ALC888 Digital"; |
| 8922 | } |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8923 | break; |
| 8924 | case 0x10ec0889: |
| 8925 | spec->stream_name_analog = "ALC889 Analog"; |
| 8926 | spec->stream_name_digital = "ALC889 Digital"; |
| 8927 | break; |
| 8928 | default: |
| 8929 | spec->stream_name_analog = "ALC883 Analog"; |
| 8930 | spec->stream_name_digital = "ALC883 Digital"; |
| 8931 | break; |
| 8932 | } |
| 8933 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8934 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8935 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8936 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8937 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8938 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8939 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8940 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8941 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8942 | spec->adc_nids = alc883_adc_nids; |
| 8943 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8944 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8945 | spec->vmaster_nid = 0x0c; |
| 8946 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8947 | codec->patch_ops = alc_patch_ops; |
| 8948 | if (board_config == ALC883_AUTO) |
| 8949 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 8950 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8951 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8952 | if (!spec->loopback.amplist) |
| 8953 | spec->loopback.amplist = alc883_loopbacks; |
| 8954 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8955 | |
| 8956 | return 0; |
| 8957 | } |
| 8958 | |
| 8959 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8960 | * ALC262 support |
| 8961 | */ |
| 8962 | |
| 8963 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8964 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8965 | |
| 8966 | #define alc262_dac_nids alc260_dac_nids |
| 8967 | #define alc262_adc_nids alc882_adc_nids |
| 8968 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8969 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8970 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8971 | |
| 8972 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8973 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8974 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 8975 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 8976 | /* ADC0 */ |
| 8977 | 0x09 |
| 8978 | }; |
| 8979 | |
| 8980 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 8981 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8982 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8984 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8985 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8986 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8987 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8988 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8989 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8990 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8991 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8992 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8993 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8994 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8995 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8996 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8997 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8998 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8999 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9000 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9001 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9002 | }; |
| 9003 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9004 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9006 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9007 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9008 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9009 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9010 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9011 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9012 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9013 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9014 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9015 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9016 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9017 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 9018 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9019 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 9020 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9021 | { } /* end */ |
| 9022 | }; |
| 9023 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9024 | /* update HP, line and mono-out pins according to the master switch */ |
| 9025 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9026 | { |
| 9027 | struct alc_spec *spec = codec->spec; |
| 9028 | int val = spec->master_sw; |
| 9029 | |
| 9030 | /* HP & line-out */ |
| 9031 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9032 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9033 | val ? PIN_HP : 0); |
| 9034 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9035 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9036 | val ? PIN_HP : 0); |
| 9037 | /* mono (speaker) depending on the HP jack sense */ |
| 9038 | val = val && !spec->jack_present; |
| 9039 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9040 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9041 | val ? PIN_OUT : 0); |
| 9042 | } |
| 9043 | |
| 9044 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9045 | { |
| 9046 | struct alc_spec *spec = codec->spec; |
| 9047 | unsigned int presence; |
| 9048 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9049 | AC_VERB_GET_PIN_SENSE, 0); |
| 9050 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9051 | alc262_hp_master_update(codec); |
| 9052 | } |
| 9053 | |
| 9054 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9055 | { |
| 9056 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9057 | return; |
| 9058 | alc262_hp_bpc_automute(codec); |
| 9059 | } |
| 9060 | |
| 9061 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9062 | { |
| 9063 | struct alc_spec *spec = codec->spec; |
| 9064 | unsigned int presence; |
| 9065 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9066 | AC_VERB_GET_PIN_SENSE, 0); |
| 9067 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9068 | alc262_hp_master_update(codec); |
| 9069 | } |
| 9070 | |
| 9071 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9072 | unsigned int res) |
| 9073 | { |
| 9074 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9075 | return; |
| 9076 | alc262_hp_wildwest_automute(codec); |
| 9077 | } |
| 9078 | |
| 9079 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 9080 | struct snd_ctl_elem_value *ucontrol) |
| 9081 | { |
| 9082 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9083 | struct alc_spec *spec = codec->spec; |
| 9084 | *ucontrol->value.integer.value = spec->master_sw; |
| 9085 | return 0; |
| 9086 | } |
| 9087 | |
| 9088 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9089 | struct snd_ctl_elem_value *ucontrol) |
| 9090 | { |
| 9091 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9092 | struct alc_spec *spec = codec->spec; |
| 9093 | int val = !!*ucontrol->value.integer.value; |
| 9094 | |
| 9095 | if (val == spec->master_sw) |
| 9096 | return 0; |
| 9097 | spec->master_sw = val; |
| 9098 | alc262_hp_master_update(codec); |
| 9099 | return 1; |
| 9100 | } |
| 9101 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9102 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9103 | { |
| 9104 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9105 | .name = "Master Playback Switch", |
| 9106 | .info = snd_ctl_boolean_mono_info, |
| 9107 | .get = alc262_hp_master_sw_get, |
| 9108 | .put = alc262_hp_master_sw_put, |
| 9109 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9110 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9111 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9112 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9113 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9114 | HDA_OUTPUT), |
| 9115 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9116 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9117 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9118 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9119 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9120 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9121 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9122 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9123 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9124 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9125 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9126 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9127 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9128 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9129 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9130 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9131 | { } /* end */ |
| 9132 | }; |
| 9133 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9134 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9135 | { |
| 9136 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9137 | .name = "Master Playback Switch", |
| 9138 | .info = snd_ctl_boolean_mono_info, |
| 9139 | .get = alc262_hp_master_sw_get, |
| 9140 | .put = alc262_hp_master_sw_put, |
| 9141 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9142 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9143 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9144 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9145 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9146 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9147 | HDA_OUTPUT), |
| 9148 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9149 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9150 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9151 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9152 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9153 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9154 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9155 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9156 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9157 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9158 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9159 | { } /* end */ |
| 9160 | }; |
| 9161 | |
| 9162 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9163 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9164 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9165 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9166 | { } /* end */ |
| 9167 | }; |
| 9168 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9169 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9170 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 9171 | { |
| 9172 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9173 | |
| 9174 | if (force || !spec->sense_updated) { |
| 9175 | unsigned int present; |
| 9176 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9177 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9178 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9179 | spec->sense_updated = 1; |
| 9180 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9181 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 9182 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9183 | } |
| 9184 | |
| 9185 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9186 | unsigned int res) |
| 9187 | { |
| 9188 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9189 | return; |
| 9190 | alc262_hp_t5735_automute(codec, 1); |
| 9191 | } |
| 9192 | |
| 9193 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9194 | { |
| 9195 | alc262_hp_t5735_automute(codec, 1); |
| 9196 | } |
| 9197 | |
| 9198 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9199 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9200 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9201 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9202 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9203 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9204 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9205 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9206 | { } /* end */ |
| 9207 | }; |
| 9208 | |
| 9209 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9210 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9212 | |
| 9213 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9214 | { } |
| 9215 | }; |
| 9216 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9217 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9218 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9219 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9220 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9221 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9222 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9223 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9224 | { } /* end */ |
| 9225 | }; |
| 9226 | |
| 9227 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9228 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9229 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9230 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9231 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9232 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9233 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9234 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9235 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9236 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9237 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9238 | {} |
| 9239 | }; |
| 9240 | |
| 9241 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9242 | .num_items = 1, |
| 9243 | .items = { |
| 9244 | { "Line", 0x1 }, |
| 9245 | }, |
| 9246 | }; |
| 9247 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9248 | /* bind hp and internal speaker mute (with plug check) */ |
| 9249 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9250 | struct snd_ctl_elem_value *ucontrol) |
| 9251 | { |
| 9252 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9253 | long *valp = ucontrol->value.integer.value; |
| 9254 | int change; |
| 9255 | |
| 9256 | /* change hp mute */ |
| 9257 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9258 | HDA_AMP_MUTE, |
| 9259 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9260 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9261 | HDA_AMP_MUTE, |
| 9262 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9263 | if (change) { |
| 9264 | /* change speaker according to HP jack state */ |
| 9265 | struct alc_spec *spec = codec->spec; |
| 9266 | unsigned int mute; |
| 9267 | if (spec->jack_present) |
| 9268 | mute = HDA_AMP_MUTE; |
| 9269 | else |
| 9270 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9271 | HDA_OUTPUT, 0); |
| 9272 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9273 | HDA_AMP_MUTE, mute); |
| 9274 | } |
| 9275 | return change; |
| 9276 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9277 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9278 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9279 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9280 | { |
| 9281 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9282 | .name = "Master Playback Switch", |
| 9283 | .info = snd_hda_mixer_amp_switch_info, |
| 9284 | .get = snd_hda_mixer_amp_switch_get, |
| 9285 | .put = alc262_sony_master_sw_put, |
| 9286 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9287 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9288 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9289 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9290 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9291 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9292 | { } /* end */ |
| 9293 | }; |
| 9294 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9295 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9296 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9297 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9298 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9299 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9300 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9301 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9302 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9303 | { } /* end */ |
| 9304 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9305 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9306 | #define alc262_capture_mixer alc882_capture_mixer |
| 9307 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9308 | |
| 9309 | /* |
| 9310 | * generic initialization of ADC, input mixers and output mixers |
| 9311 | */ |
| 9312 | static struct hda_verb alc262_init_verbs[] = { |
| 9313 | /* |
| 9314 | * Unmute ADC0-2 and set the default input to mic-in |
| 9315 | */ |
| 9316 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9317 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9318 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9319 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9320 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9321 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9322 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9323 | /* 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] | 9324 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9325 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9326 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9327 | */ |
| 9328 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9329 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9330 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9331 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9332 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9333 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9334 | |
| 9335 | /* |
| 9336 | * Set up output mixers (0x0c - 0x0e) |
| 9337 | */ |
| 9338 | /* set vol=0 to output mixers */ |
| 9339 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9340 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9341 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9342 | /* set up input amps for analog loopback */ |
| 9343 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9344 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9345 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9346 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9347 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9349 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9350 | |
| 9351 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9352 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9353 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9354 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9355 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9356 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9357 | |
| 9358 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9359 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9360 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9361 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9362 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9363 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9364 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9365 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9366 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9367 | /* FIXME: use matrix-type input source selection */ |
| 9368 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9369 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9370 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9371 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9372 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9373 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9374 | /* Input mixer2 */ |
| 9375 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9376 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9377 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9378 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9379 | /* Input mixer3 */ |
| 9380 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9381 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9382 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9383 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9384 | |
| 9385 | { } |
| 9386 | }; |
| 9387 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9388 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9389 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9390 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9391 | { } |
| 9392 | }; |
| 9393 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9394 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9395 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9396 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9397 | {} |
| 9398 | }; |
| 9399 | |
| 9400 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9401 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9402 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9403 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9404 | |
| 9405 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9406 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9407 | {} |
| 9408 | }; |
| 9409 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9410 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9411 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9412 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9413 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9414 | |
| 9415 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9416 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9417 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9418 | }; |
| 9419 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9420 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9421 | .num_items = 2, |
| 9422 | .items = { |
| 9423 | { "Int DMic", 0x9 }, |
| 9424 | { "Mic", 0x0 }, |
| 9425 | }, |
| 9426 | }; |
| 9427 | |
| 9428 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9429 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9430 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9431 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9432 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9433 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9434 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9435 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9436 | { |
| 9437 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9438 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9439 | * So call somewhat different.. |
| 9440 | */ |
| 9441 | /* .name = "Capture Source", */ |
| 9442 | .name = "Input Source", |
| 9443 | .count = 1, |
| 9444 | .info = alc_mux_enum_info, |
| 9445 | .get = alc_mux_enum_get, |
| 9446 | .put = alc_mux_enum_put, |
| 9447 | }, |
| 9448 | { } /* end */ |
| 9449 | }; |
| 9450 | |
| 9451 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9452 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9453 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9454 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9455 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9456 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9457 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9458 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9459 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9460 | {} |
| 9461 | }; |
| 9462 | |
| 9463 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9464 | { |
| 9465 | unsigned int present; |
| 9466 | |
| 9467 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9468 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9469 | snd_hda_codec_write(codec, 0x22, 0, |
| 9470 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9471 | } |
| 9472 | |
| 9473 | /* toggle speaker-output according to the hp-jack state */ |
| 9474 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9475 | { |
| 9476 | unsigned int present; |
| 9477 | unsigned char bits; |
| 9478 | |
| 9479 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9480 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9481 | bits = present ? 0 : PIN_OUT; |
| 9482 | snd_hda_codec_write(codec, 0x14, 0, |
| 9483 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9484 | } |
| 9485 | |
| 9486 | |
| 9487 | |
| 9488 | /* unsolicited event for HP jack sensing */ |
| 9489 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9490 | unsigned int res) |
| 9491 | { |
| 9492 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9493 | alc262_toshiba_s06_speaker_automute(codec); |
| 9494 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9495 | alc262_dmic_automute(codec); |
| 9496 | |
| 9497 | } |
| 9498 | |
| 9499 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9500 | { |
| 9501 | alc262_toshiba_s06_speaker_automute(codec); |
| 9502 | alc262_dmic_automute(codec); |
| 9503 | } |
| 9504 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9505 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9506 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9507 | { |
| 9508 | struct alc_spec *spec = codec->spec; |
| 9509 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9510 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9511 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9512 | /* need to execute and sync at first */ |
| 9513 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9514 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9515 | AC_VERB_GET_PIN_SENSE, 0); |
| 9516 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9517 | if (spec->jack_present) { |
| 9518 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9519 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9520 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9521 | } else { |
| 9522 | /* unmute internal speaker if necessary */ |
| 9523 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9524 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9525 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9526 | } |
| 9527 | } |
| 9528 | |
| 9529 | /* unsolicited event for HP jack sensing */ |
| 9530 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9531 | unsigned int res) |
| 9532 | { |
| 9533 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9534 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9535 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9536 | } |
| 9537 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9538 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9539 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9540 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9541 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9542 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9543 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9544 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9545 | AC_VERB_GET_PIN_SENSE, 0); |
| 9546 | present = (present & 0x80000000) != 0; |
| 9547 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9548 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9549 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9550 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9551 | } else { |
| 9552 | /* unmute internal speaker if necessary */ |
| 9553 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9554 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9555 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9556 | } |
| 9557 | } |
| 9558 | |
| 9559 | /* unsolicited event for HP jack sensing */ |
| 9560 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9561 | unsigned int res) |
| 9562 | { |
| 9563 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9564 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9565 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9566 | } |
| 9567 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9568 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9569 | * nec model |
| 9570 | * 0x15 = headphone |
| 9571 | * 0x16 = internal speaker |
| 9572 | * 0x18 = external mic |
| 9573 | */ |
| 9574 | |
| 9575 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9576 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9577 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9578 | |
| 9579 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9580 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9581 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9582 | |
| 9583 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9584 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9585 | { } /* end */ |
| 9586 | }; |
| 9587 | |
| 9588 | static struct hda_verb alc262_nec_verbs[] = { |
| 9589 | /* Unmute Speaker */ |
| 9590 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9591 | |
| 9592 | /* Headphone */ |
| 9593 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9594 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9595 | |
| 9596 | /* External mic to headphone */ |
| 9597 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9598 | /* External mic to speaker */ |
| 9599 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9600 | {} |
| 9601 | }; |
| 9602 | |
| 9603 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9604 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9605 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9606 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9607 | */ |
| 9608 | |
| 9609 | #define ALC_HP_EVENT 0x37 |
| 9610 | |
| 9611 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9612 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9613 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9614 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9615 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9616 | {} |
| 9617 | }; |
| 9618 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9619 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9620 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9621 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9622 | {} |
| 9623 | }; |
| 9624 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9625 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9626 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9627 | .items = { |
| 9628 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9629 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9630 | { "CD", 0x4 }, |
| 9631 | }, |
| 9632 | }; |
| 9633 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9634 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9635 | .num_items = 5, |
| 9636 | .items = { |
| 9637 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9638 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9639 | { "Line", 0x2 }, |
| 9640 | { "CD", 0x4 }, |
| 9641 | { "AUX IN", 0x6 }, |
| 9642 | }, |
| 9643 | }; |
| 9644 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9645 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9646 | .num_items = 4, |
| 9647 | .items = { |
| 9648 | { "Mic", 0x0 }, |
| 9649 | { "Front Mic", 0x2 }, |
| 9650 | { "Line", 0x1 }, |
| 9651 | { "CD", 0x4 }, |
| 9652 | }, |
| 9653 | }; |
| 9654 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9655 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9656 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9657 | { |
| 9658 | struct alc_spec *spec = codec->spec; |
| 9659 | unsigned int mute; |
| 9660 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9661 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9662 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9663 | /* need to execute and sync at first */ |
| 9664 | 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] | 9665 | /* check laptop HP jack */ |
| 9666 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9667 | AC_VERB_GET_PIN_SENSE, 0); |
| 9668 | /* need to execute and sync at first */ |
| 9669 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9670 | /* check docking HP jack */ |
| 9671 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9672 | AC_VERB_GET_PIN_SENSE, 0); |
| 9673 | if (present & AC_PINSENSE_PRESENCE) |
| 9674 | spec->jack_present = 1; |
| 9675 | else |
| 9676 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9677 | spec->sense_updated = 1; |
| 9678 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9679 | /* unmute internal speaker only if both HPs are unplugged and |
| 9680 | * master switch is on |
| 9681 | */ |
| 9682 | if (spec->jack_present) |
| 9683 | mute = HDA_AMP_MUTE; |
| 9684 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9685 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9686 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9687 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9688 | } |
| 9689 | |
| 9690 | /* unsolicited event for HP jack sensing */ |
| 9691 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9692 | unsigned int res) |
| 9693 | { |
| 9694 | if ((res >> 26) != ALC_HP_EVENT) |
| 9695 | return; |
| 9696 | alc262_fujitsu_automute(codec, 1); |
| 9697 | } |
| 9698 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9699 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9700 | { |
| 9701 | alc262_fujitsu_automute(codec, 1); |
| 9702 | } |
| 9703 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9704 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9705 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 9706 | .ops = &snd_hda_bind_vol, |
| 9707 | .values = { |
| 9708 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 9709 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 9710 | 0 |
| 9711 | }, |
| 9712 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9713 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9714 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9715 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 9716 | { |
| 9717 | struct alc_spec *spec = codec->spec; |
| 9718 | unsigned int mute; |
| 9719 | |
| 9720 | if (force || !spec->sense_updated) { |
| 9721 | unsigned int present_int_hp; |
| 9722 | /* need to execute and sync at first */ |
| 9723 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9724 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 9725 | AC_VERB_GET_PIN_SENSE, 0); |
| 9726 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 9727 | spec->sense_updated = 1; |
| 9728 | } |
| 9729 | if (spec->jack_present) { |
| 9730 | /* mute internal speaker */ |
| 9731 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9732 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9733 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9734 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9735 | } else { |
| 9736 | /* unmute internal speaker if necessary */ |
| 9737 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9738 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9739 | HDA_AMP_MUTE, mute); |
| 9740 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9741 | HDA_AMP_MUTE, mute); |
| 9742 | } |
| 9743 | } |
| 9744 | |
| 9745 | /* unsolicited event for HP jack sensing */ |
| 9746 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 9747 | unsigned int res) |
| 9748 | { |
| 9749 | if ((res >> 26) != ALC_HP_EVENT) |
| 9750 | return; |
| 9751 | alc262_lenovo_3000_automute(codec, 1); |
| 9752 | } |
| 9753 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9754 | /* bind hp and internal speaker mute (with plug check) */ |
| 9755 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9756 | struct snd_ctl_elem_value *ucontrol) |
| 9757 | { |
| 9758 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9759 | long *valp = ucontrol->value.integer.value; |
| 9760 | int change; |
| 9761 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9762 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9763 | HDA_AMP_MUTE, |
| 9764 | valp ? 0 : HDA_AMP_MUTE); |
| 9765 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9766 | HDA_AMP_MUTE, |
| 9767 | valp ? 0 : HDA_AMP_MUTE); |
| 9768 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 9769 | if (change) |
| 9770 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9771 | return change; |
| 9772 | } |
| 9773 | |
| 9774 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9775 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9776 | { |
| 9777 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9778 | .name = "Master Playback Switch", |
| 9779 | .info = snd_hda_mixer_amp_switch_info, |
| 9780 | .get = snd_hda_mixer_amp_switch_get, |
| 9781 | .put = alc262_fujitsu_master_sw_put, |
| 9782 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9783 | }, |
| 9784 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9785 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 9786 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 9787 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9788 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9789 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9790 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9791 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9792 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9793 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9794 | { } /* end */ |
| 9795 | }; |
| 9796 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9797 | /* bind hp and internal speaker mute (with plug check) */ |
| 9798 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9799 | struct snd_ctl_elem_value *ucontrol) |
| 9800 | { |
| 9801 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9802 | long *valp = ucontrol->value.integer.value; |
| 9803 | int change; |
| 9804 | |
| 9805 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9806 | HDA_AMP_MUTE, |
| 9807 | valp ? 0 : HDA_AMP_MUTE); |
| 9808 | |
| 9809 | if (change) |
| 9810 | alc262_lenovo_3000_automute(codec, 0); |
| 9811 | return change; |
| 9812 | } |
| 9813 | |
| 9814 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 9815 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9816 | { |
| 9817 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9818 | .name = "Master Playback Switch", |
| 9819 | .info = snd_hda_mixer_amp_switch_info, |
| 9820 | .get = snd_hda_mixer_amp_switch_get, |
| 9821 | .put = alc262_lenovo_3000_master_sw_put, |
| 9822 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 9823 | }, |
| 9824 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9825 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9826 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9828 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9829 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9830 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9831 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9832 | { } /* end */ |
| 9833 | }; |
| 9834 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 9835 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 9836 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9837 | { |
| 9838 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9839 | .name = "Master Playback Switch", |
| 9840 | .info = snd_hda_mixer_amp_switch_info, |
| 9841 | .get = snd_hda_mixer_amp_switch_get, |
| 9842 | .put = alc262_sony_master_sw_put, |
| 9843 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9844 | }, |
| 9845 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9846 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9847 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9848 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9849 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9850 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9851 | { } /* end */ |
| 9852 | }; |
| 9853 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9854 | /* additional init verbs for Benq laptops */ |
| 9855 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 9856 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9857 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9858 | {} |
| 9859 | }; |
| 9860 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9861 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 9862 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9863 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9864 | |
| 9865 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9866 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 9867 | {} |
| 9868 | }; |
| 9869 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9870 | /* Samsung Q1 Ultra Vista model setup */ |
| 9871 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9872 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9873 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9874 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9875 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9876 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9877 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9878 | { } /* end */ |
| 9879 | }; |
| 9880 | |
| 9881 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9882 | /* output mixer */ |
| 9883 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9884 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9886 | /* speaker */ |
| 9887 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9888 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9889 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9890 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9891 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9892 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9893 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9894 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9895 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9896 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9897 | /* internal mic */ |
| 9898 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9899 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9900 | /* ADC, choose mic */ |
| 9901 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9902 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9903 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9904 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9905 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9906 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9907 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9908 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9909 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 9910 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9911 | {} |
| 9912 | }; |
| 9913 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9914 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9915 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9916 | { |
| 9917 | struct alc_spec *spec = codec->spec; |
| 9918 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9919 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9920 | mute = 0; |
| 9921 | /* auto-mute only when HP is used as HP */ |
| 9922 | if (!spec->cur_mux[0]) { |
| 9923 | unsigned int present; |
| 9924 | /* need to execute and sync at first */ |
| 9925 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9926 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9927 | AC_VERB_GET_PIN_SENSE, 0); |
| 9928 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9929 | if (spec->jack_present) |
| 9930 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9931 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9932 | /* mute/unmute internal speaker */ |
| 9933 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9934 | HDA_AMP_MUTE, mute); |
| 9935 | /* mute/unmute HP */ |
| 9936 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9937 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9938 | } |
| 9939 | |
| 9940 | /* unsolicited event for HP jack sensing */ |
| 9941 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9942 | unsigned int res) |
| 9943 | { |
| 9944 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9945 | return; |
| 9946 | alc262_ultra_automute(codec); |
| 9947 | } |
| 9948 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9949 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9950 | .num_items = 2, |
| 9951 | .items = { |
| 9952 | { "Mic", 0x1 }, |
| 9953 | { "Headphone", 0x7 }, |
| 9954 | }, |
| 9955 | }; |
| 9956 | |
| 9957 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9958 | struct snd_ctl_elem_value *ucontrol) |
| 9959 | { |
| 9960 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9961 | struct alc_spec *spec = codec->spec; |
| 9962 | int ret; |
| 9963 | |
| 9964 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 9965 | if (!ret) |
| 9966 | return 0; |
| 9967 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9968 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9969 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9970 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9971 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9972 | return ret; |
| 9973 | } |
| 9974 | |
| 9975 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9976 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9977 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9978 | { |
| 9979 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9980 | .name = "Capture Source", |
| 9981 | .info = alc882_mux_enum_info, |
| 9982 | .get = alc882_mux_enum_get, |
| 9983 | .put = alc262_ultra_mux_enum_put, |
| 9984 | }, |
| 9985 | { } /* end */ |
| 9986 | }; |
| 9987 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9988 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9989 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9990 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9991 | { |
| 9992 | hda_nid_t nid; |
| 9993 | int err; |
| 9994 | |
| 9995 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9996 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9997 | spec->multiout.dac_nids[0] = 2; |
| 9998 | |
| 9999 | nid = cfg->line_out_pins[0]; |
| 10000 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10001 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10002 | "Front Playback Volume", |
| 10003 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10004 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10005 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10006 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10007 | "Front Playback Switch", |
| 10008 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10009 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10010 | return err; |
| 10011 | } |
| 10012 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10013 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10014 | if (nid) { |
| 10015 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10016 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10017 | "Speaker Playback Volume", |
| 10018 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10019 | HDA_OUTPUT)); |
| 10020 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10021 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10022 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10023 | "Speaker Playback Switch", |
| 10024 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10025 | HDA_OUTPUT)); |
| 10026 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10027 | return err; |
| 10028 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10029 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10030 | "Speaker Playback Switch", |
| 10031 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10032 | HDA_OUTPUT)); |
| 10033 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10034 | return err; |
| 10035 | } |
| 10036 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10037 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10038 | if (nid) { |
| 10039 | /* spec->multiout.hp_nid = 2; */ |
| 10040 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10041 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10042 | "Headphone Playback Volume", |
| 10043 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10044 | HDA_OUTPUT)); |
| 10045 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10046 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10047 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10048 | "Headphone Playback Switch", |
| 10049 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10050 | HDA_OUTPUT)); |
| 10051 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10052 | return err; |
| 10053 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10054 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10055 | "Headphone Playback Switch", |
| 10056 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10057 | HDA_OUTPUT)); |
| 10058 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10059 | return err; |
| 10060 | } |
| 10061 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10062 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10063 | } |
| 10064 | |
| 10065 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10066 | #define alc262_auto_create_analog_input_ctls \ |
| 10067 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10068 | |
| 10069 | /* |
| 10070 | * generic initialization of ADC, input mixers and output mixers |
| 10071 | */ |
| 10072 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10073 | /* |
| 10074 | * Unmute ADC0-2 and set the default input to mic-in |
| 10075 | */ |
| 10076 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10077 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10078 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10079 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10080 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10081 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10082 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10083 | /* 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] | 10084 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10085 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10086 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10087 | */ |
| 10088 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10089 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10090 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10091 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10092 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10093 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10094 | |
| 10095 | /* |
| 10096 | * Set up output mixers (0x0c - 0x0f) |
| 10097 | */ |
| 10098 | /* set vol=0 to output mixers */ |
| 10099 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10100 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10101 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10102 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10103 | /* set up input amps for analog loopback */ |
| 10104 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10105 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10106 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10107 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10108 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10109 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10110 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10111 | |
| 10112 | /* FIXME: use matrix-type input source selection */ |
| 10113 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10114 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10115 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10116 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10117 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10118 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10119 | /* Input mixer2 */ |
| 10120 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10121 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10122 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10123 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10124 | /* Input mixer3 */ |
| 10125 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10126 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10127 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10128 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10129 | |
| 10130 | { } |
| 10131 | }; |
| 10132 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10133 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10134 | /* |
| 10135 | * Unmute ADC0-2 and set the default input to mic-in |
| 10136 | */ |
| 10137 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10138 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10139 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10140 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10141 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10142 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10143 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10144 | /* 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] | 10145 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10146 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10147 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10148 | */ |
| 10149 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10150 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10151 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10152 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10153 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10154 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10155 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10156 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10157 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10158 | /* |
| 10159 | * Set up output mixers (0x0c - 0x0e) |
| 10160 | */ |
| 10161 | /* set vol=0 to output mixers */ |
| 10162 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10163 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10164 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10165 | |
| 10166 | /* set up input amps for analog loopback */ |
| 10167 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10168 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10169 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10170 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10171 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10172 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10173 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10174 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10175 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10176 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10177 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10178 | |
| 10179 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10180 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10181 | |
| 10182 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10183 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10184 | |
| 10185 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10186 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10187 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10188 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10189 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10190 | |
| 10191 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10192 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10193 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10194 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10195 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10196 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10197 | |
| 10198 | |
| 10199 | /* FIXME: use matrix-type input source selection */ |
| 10200 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10201 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10202 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10203 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10204 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10205 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10206 | /* Input mixer2 */ |
| 10207 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10208 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10209 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10210 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10211 | /* Input mixer3 */ |
| 10212 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10213 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10214 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10215 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10216 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10217 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10218 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10219 | { } |
| 10220 | }; |
| 10221 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10222 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10223 | /* |
| 10224 | * Unmute ADC0-2 and set the default input to mic-in |
| 10225 | */ |
| 10226 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10227 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10228 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10229 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10230 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10231 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10232 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10233 | /* 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] | 10234 | * mixer widget |
| 10235 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10236 | * panel mic (mic 2) |
| 10237 | */ |
| 10238 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10239 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10240 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10241 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10242 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10243 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10244 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10245 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10246 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10247 | /* |
| 10248 | * Set up output mixers (0x0c - 0x0e) |
| 10249 | */ |
| 10250 | /* set vol=0 to output mixers */ |
| 10251 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10252 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10253 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10254 | |
| 10255 | /* set up input amps for analog loopback */ |
| 10256 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10257 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10258 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10259 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10260 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10261 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10262 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10263 | |
| 10264 | |
| 10265 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10266 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10267 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10268 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10269 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10270 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10271 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10272 | |
| 10273 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10274 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10275 | |
| 10276 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10277 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10278 | |
| 10279 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10280 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10281 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10282 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10283 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10284 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10285 | |
| 10286 | /* FIXME: use matrix-type input source selection */ |
| 10287 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10288 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10289 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10290 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10291 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10292 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10293 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10294 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10295 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10296 | /* Input mixer2 */ |
| 10297 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10299 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10300 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10301 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10302 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10303 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10304 | /* Input mixer3 */ |
| 10305 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10306 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10307 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10308 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10309 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10310 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10311 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10312 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10313 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10314 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10315 | { } |
| 10316 | }; |
| 10317 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10318 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10319 | |
| 10320 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10321 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10322 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10323 | |
| 10324 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10325 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10326 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10327 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10328 | |
| 10329 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10330 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10331 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10332 | {} |
| 10333 | }; |
| 10334 | |
| 10335 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10336 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10337 | #define alc262_loopbacks alc880_loopbacks |
| 10338 | #endif |
| 10339 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10340 | /* pcm configuration: identiacal with ALC880 */ |
| 10341 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10342 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10343 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10344 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10345 | |
| 10346 | /* |
| 10347 | * BIOS auto configuration |
| 10348 | */ |
| 10349 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10350 | { |
| 10351 | struct alc_spec *spec = codec->spec; |
| 10352 | int err; |
| 10353 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10354 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10355 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10356 | alc262_ignore); |
| 10357 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10358 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10359 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10360 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10361 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10362 | if (err < 0) |
| 10363 | return err; |
| 10364 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10365 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10366 | return err; |
| 10367 | |
| 10368 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10369 | |
| 10370 | if (spec->autocfg.dig_out_pin) |
| 10371 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 10372 | if (spec->autocfg.dig_in_pin) |
| 10373 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10374 | |
| 10375 | if (spec->kctl_alloc) |
| 10376 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10377 | |
| 10378 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10379 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10380 | spec->input_mux = &spec->private_imux; |
| 10381 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10382 | err = alc_auto_add_mic_boost(codec); |
| 10383 | if (err < 0) |
| 10384 | return err; |
| 10385 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame^] | 10386 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10387 | return 1; |
| 10388 | } |
| 10389 | |
| 10390 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10391 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10392 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10393 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10394 | |
| 10395 | |
| 10396 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10397 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10398 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10399 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10400 | alc262_auto_init_multi_out(codec); |
| 10401 | alc262_auto_init_hp_out(codec); |
| 10402 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10403 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10404 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10405 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10406 | } |
| 10407 | |
| 10408 | /* |
| 10409 | * configuration and preset |
| 10410 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10411 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10412 | [ALC262_BASIC] = "basic", |
| 10413 | [ALC262_HIPPO] = "hippo", |
| 10414 | [ALC262_HIPPO_1] = "hippo_1", |
| 10415 | [ALC262_FUJITSU] = "fujitsu", |
| 10416 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10417 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10418 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10419 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10420 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10421 | [ALC262_BENQ_T31] = "benq-t31", |
| 10422 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10423 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10424 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10425 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10426 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10427 | [ALC262_NEC] = "nec", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10428 | [ALC262_AUTO] = "auto", |
| 10429 | }; |
| 10430 | |
| 10431 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10432 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10433 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10434 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10435 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10436 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 10437 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10438 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10439 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10440 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10441 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10442 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10443 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10444 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10445 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10446 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10447 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10448 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10449 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10450 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10451 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10452 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10453 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10454 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10455 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10456 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10457 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10458 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10459 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10460 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10461 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10462 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10463 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10464 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10465 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10466 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10467 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10468 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10469 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10470 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10471 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10472 | {} |
| 10473 | }; |
| 10474 | |
| 10475 | static struct alc_config_preset alc262_presets[] = { |
| 10476 | [ALC262_BASIC] = { |
| 10477 | .mixers = { alc262_base_mixer }, |
| 10478 | .init_verbs = { alc262_init_verbs }, |
| 10479 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10480 | .dac_nids = alc262_dac_nids, |
| 10481 | .hp_nid = 0x03, |
| 10482 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10483 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10484 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10485 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10486 | [ALC262_HIPPO] = { |
| 10487 | .mixers = { alc262_base_mixer }, |
| 10488 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10489 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10490 | .dac_nids = alc262_dac_nids, |
| 10491 | .hp_nid = 0x03, |
| 10492 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10493 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10494 | .channel_mode = alc262_modes, |
| 10495 | .input_mux = &alc262_capture_source, |
| 10496 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10497 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10498 | }, |
| 10499 | [ALC262_HIPPO_1] = { |
| 10500 | .mixers = { alc262_hippo1_mixer }, |
| 10501 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10502 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10503 | .dac_nids = alc262_dac_nids, |
| 10504 | .hp_nid = 0x02, |
| 10505 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10506 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10507 | .channel_mode = alc262_modes, |
| 10508 | .input_mux = &alc262_capture_source, |
| 10509 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10510 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10511 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10512 | [ALC262_FUJITSU] = { |
| 10513 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10514 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10515 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10516 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10517 | .dac_nids = alc262_dac_nids, |
| 10518 | .hp_nid = 0x03, |
| 10519 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10520 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10521 | .channel_mode = alc262_modes, |
| 10522 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10523 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10524 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10525 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10526 | [ALC262_HP_BPC] = { |
| 10527 | .mixers = { alc262_HP_BPC_mixer }, |
| 10528 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10529 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10530 | .dac_nids = alc262_dac_nids, |
| 10531 | .hp_nid = 0x03, |
| 10532 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10533 | .channel_mode = alc262_modes, |
| 10534 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10535 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10536 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10537 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10538 | [ALC262_HP_BPC_D7000_WF] = { |
| 10539 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10540 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10541 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10542 | .dac_nids = alc262_dac_nids, |
| 10543 | .hp_nid = 0x03, |
| 10544 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10545 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10546 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10547 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10548 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10549 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10550 | [ALC262_HP_BPC_D7000_WL] = { |
| 10551 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10552 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10553 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10554 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10555 | .dac_nids = alc262_dac_nids, |
| 10556 | .hp_nid = 0x03, |
| 10557 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10558 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10559 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10560 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10561 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10562 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10563 | [ALC262_HP_TC_T5735] = { |
| 10564 | .mixers = { alc262_hp_t5735_mixer }, |
| 10565 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10566 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10567 | .dac_nids = alc262_dac_nids, |
| 10568 | .hp_nid = 0x03, |
| 10569 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10570 | .channel_mode = alc262_modes, |
| 10571 | .input_mux = &alc262_capture_source, |
| 10572 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10573 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10574 | }, |
| 10575 | [ALC262_HP_RP5700] = { |
| 10576 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10577 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10578 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10579 | .dac_nids = alc262_dac_nids, |
| 10580 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10581 | .channel_mode = alc262_modes, |
| 10582 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10583 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10584 | [ALC262_BENQ_ED8] = { |
| 10585 | .mixers = { alc262_base_mixer }, |
| 10586 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10587 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10588 | .dac_nids = alc262_dac_nids, |
| 10589 | .hp_nid = 0x03, |
| 10590 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10591 | .channel_mode = alc262_modes, |
| 10592 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10593 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10594 | [ALC262_SONY_ASSAMD] = { |
| 10595 | .mixers = { alc262_sony_mixer }, |
| 10596 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10597 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10598 | .dac_nids = alc262_dac_nids, |
| 10599 | .hp_nid = 0x02, |
| 10600 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10601 | .channel_mode = alc262_modes, |
| 10602 | .input_mux = &alc262_capture_source, |
| 10603 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10604 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10605 | }, |
| 10606 | [ALC262_BENQ_T31] = { |
| 10607 | .mixers = { alc262_benq_t31_mixer }, |
| 10608 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10609 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10610 | .dac_nids = alc262_dac_nids, |
| 10611 | .hp_nid = 0x03, |
| 10612 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10613 | .channel_mode = alc262_modes, |
| 10614 | .input_mux = &alc262_capture_source, |
| 10615 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10616 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10617 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10618 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10619 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 10620 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10621 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10622 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10623 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10624 | .channel_mode = alc262_modes, |
| 10625 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10626 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10627 | .capsrc_nids = alc262_capsrc_nids, |
| 10628 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10629 | .unsol_event = alc262_ultra_unsol_event, |
| 10630 | .init_hook = alc262_ultra_automute, |
| 10631 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10632 | [ALC262_LENOVO_3000] = { |
| 10633 | .mixers = { alc262_lenovo_3000_mixer }, |
| 10634 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10635 | alc262_lenovo_3000_unsol_verbs }, |
| 10636 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10637 | .dac_nids = alc262_dac_nids, |
| 10638 | .hp_nid = 0x03, |
| 10639 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10640 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10641 | .channel_mode = alc262_modes, |
| 10642 | .input_mux = &alc262_fujitsu_capture_source, |
| 10643 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 10644 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10645 | [ALC262_NEC] = { |
| 10646 | .mixers = { alc262_nec_mixer }, |
| 10647 | .init_verbs = { alc262_nec_verbs }, |
| 10648 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10649 | .dac_nids = alc262_dac_nids, |
| 10650 | .hp_nid = 0x03, |
| 10651 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10652 | .channel_mode = alc262_modes, |
| 10653 | .input_mux = &alc262_capture_source, |
| 10654 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10655 | [ALC262_TOSHIBA_S06] = { |
| 10656 | .mixers = { alc262_toshiba_s06_mixer }, |
| 10657 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 10658 | alc262_eapd_verbs }, |
| 10659 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10660 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 10661 | .dac_nids = alc262_dac_nids, |
| 10662 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 10663 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10664 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10665 | .channel_mode = alc262_modes, |
| 10666 | .input_mux = &alc262_dmic_capture_source, |
| 10667 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 10668 | .init_hook = alc262_toshiba_s06_init_hook, |
| 10669 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10670 | [ALC262_TOSHIBA_RX1] = { |
| 10671 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 10672 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 10673 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10674 | .dac_nids = alc262_dac_nids, |
| 10675 | .hp_nid = 0x03, |
| 10676 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10677 | .channel_mode = alc262_modes, |
| 10678 | .input_mux = &alc262_capture_source, |
| 10679 | .unsol_event = alc262_hippo_unsol_event, |
| 10680 | .init_hook = alc262_hippo_automute, |
| 10681 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10682 | }; |
| 10683 | |
| 10684 | static int patch_alc262(struct hda_codec *codec) |
| 10685 | { |
| 10686 | struct alc_spec *spec; |
| 10687 | int board_config; |
| 10688 | int err; |
| 10689 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 10690 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10691 | if (spec == NULL) |
| 10692 | return -ENOMEM; |
| 10693 | |
| 10694 | codec->spec = spec; |
| 10695 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10696 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 10697 | * under-run |
| 10698 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10699 | { |
| 10700 | int tmp; |
| 10701 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10702 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 10703 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10704 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 10705 | } |
| 10706 | #endif |
| 10707 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 10708 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10709 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10710 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 10711 | alc262_models, |
| 10712 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10713 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10714 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10715 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 10716 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10717 | board_config = ALC262_AUTO; |
| 10718 | } |
| 10719 | |
| 10720 | if (board_config == ALC262_AUTO) { |
| 10721 | /* automatic parse from the BIOS config */ |
| 10722 | err = alc262_parse_auto_config(codec); |
| 10723 | if (err < 0) { |
| 10724 | alc_free(codec); |
| 10725 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10726 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10727 | printk(KERN_INFO |
| 10728 | "hda_codec: Cannot set up configuration " |
| 10729 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10730 | board_config = ALC262_BASIC; |
| 10731 | } |
| 10732 | } |
| 10733 | |
| 10734 | if (board_config != ALC262_AUTO) |
| 10735 | setup_preset(spec, &alc262_presets[board_config]); |
| 10736 | |
| 10737 | spec->stream_name_analog = "ALC262 Analog"; |
| 10738 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 10739 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10740 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10741 | spec->stream_name_digital = "ALC262 Digital"; |
| 10742 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 10743 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 10744 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10745 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10746 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 10747 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 10748 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10749 | /* get type */ |
| 10750 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10751 | if (wcap != AC_WID_AUD_IN) { |
| 10752 | spec->adc_nids = alc262_adc_nids_alt; |
| 10753 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10754 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10755 | spec->mixers[spec->num_mixers] = |
| 10756 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10757 | spec->num_mixers++; |
| 10758 | } else { |
| 10759 | spec->adc_nids = alc262_adc_nids; |
| 10760 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10761 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10762 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 10763 | spec->num_mixers++; |
| 10764 | } |
| 10765 | } |
| 10766 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10767 | spec->vmaster_nid = 0x0c; |
| 10768 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10769 | codec->patch_ops = alc_patch_ops; |
| 10770 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10771 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10772 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10773 | if (!spec->loopback.amplist) |
| 10774 | spec->loopback.amplist = alc262_loopbacks; |
| 10775 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10776 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10777 | return 0; |
| 10778 | } |
| 10779 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10780 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10781 | * ALC268 channel source setting (2 channel) |
| 10782 | */ |
| 10783 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 10784 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10785 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10786 | static hda_nid_t alc268_dac_nids[2] = { |
| 10787 | /* front, hp */ |
| 10788 | 0x02, 0x03 |
| 10789 | }; |
| 10790 | |
| 10791 | static hda_nid_t alc268_adc_nids[2] = { |
| 10792 | /* ADC0-1 */ |
| 10793 | 0x08, 0x07 |
| 10794 | }; |
| 10795 | |
| 10796 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 10797 | /* ADC0 */ |
| 10798 | 0x08 |
| 10799 | }; |
| 10800 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10801 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 10802 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10803 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 10804 | /* output mixer control */ |
| 10805 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10806 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10807 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10808 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10809 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10810 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10811 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10812 | { } |
| 10813 | }; |
| 10814 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10815 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 10816 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 10817 | .ops = &snd_hda_bind_sw, |
| 10818 | .values = { |
| 10819 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 10820 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 10821 | 0 |
| 10822 | }, |
| 10823 | }; |
| 10824 | |
| 10825 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 10826 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 10827 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 10828 | { } |
| 10829 | }; |
| 10830 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10831 | static struct hda_verb alc268_eapd_verbs[] = { |
| 10832 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10833 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10834 | { } |
| 10835 | }; |
| 10836 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10837 | /* Toshiba specific */ |
| 10838 | #define alc268_toshiba_automute alc262_hippo_automute |
| 10839 | |
| 10840 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 10841 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10842 | { } /* end */ |
| 10843 | }; |
| 10844 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10845 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 10846 | .num_items = 2, |
| 10847 | .items = { |
| 10848 | { "i-Mic", 0x6 }, |
| 10849 | { "E-Mic", 0x0 }, |
| 10850 | }, |
| 10851 | }; |
| 10852 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10853 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10854 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 10855 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 10856 | .ops = &snd_hda_bind_vol, |
| 10857 | .values = { |
| 10858 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 10859 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 10860 | 0 |
| 10861 | }, |
| 10862 | }; |
| 10863 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10864 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10865 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 10866 | { |
| 10867 | struct alc_spec *spec = codec->spec; |
| 10868 | unsigned int mute; |
| 10869 | |
| 10870 | if (force || !spec->sense_updated) { |
| 10871 | unsigned int present; |
| 10872 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10873 | AC_VERB_GET_PIN_SENSE, 0); |
| 10874 | spec->jack_present = (present & 0x80000000) != 0; |
| 10875 | spec->sense_updated = 1; |
| 10876 | } |
| 10877 | if (spec->jack_present) |
| 10878 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 10879 | else /* unmute internal speaker if necessary */ |
| 10880 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 10881 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10882 | HDA_AMP_MUTE, mute); |
| 10883 | } |
| 10884 | |
| 10885 | |
| 10886 | /* bind hp and internal speaker mute (with plug check) */ |
| 10887 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10888 | struct snd_ctl_elem_value *ucontrol) |
| 10889 | { |
| 10890 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10891 | long *valp = ucontrol->value.integer.value; |
| 10892 | int change; |
| 10893 | |
| 10894 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10895 | HDA_AMP_MUTE, |
| 10896 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 10897 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10898 | HDA_AMP_MUTE, |
| 10899 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 10900 | if (change) |
| 10901 | alc268_acer_automute(codec, 0); |
| 10902 | return change; |
| 10903 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10904 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10905 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 10906 | /* output mixer control */ |
| 10907 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10908 | { |
| 10909 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10910 | .name = "Master Playback Switch", |
| 10911 | .info = snd_hda_mixer_amp_switch_info, |
| 10912 | .get = snd_hda_mixer_amp_switch_get, |
| 10913 | .put = alc268_acer_master_sw_put, |
| 10914 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10915 | }, |
| 10916 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 10917 | { } |
| 10918 | }; |
| 10919 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10920 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 10921 | /* output mixer control */ |
| 10922 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10923 | { |
| 10924 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10925 | .name = "Master Playback Switch", |
| 10926 | .info = snd_hda_mixer_amp_switch_info, |
| 10927 | .get = snd_hda_mixer_amp_switch_get, |
| 10928 | .put = alc268_acer_master_sw_put, |
| 10929 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10930 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10931 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10932 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10933 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10934 | { } |
| 10935 | }; |
| 10936 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10937 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 10938 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10939 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10940 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10941 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10942 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 10943 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 10944 | { } |
| 10945 | }; |
| 10946 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10947 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10948 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 10949 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10950 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10951 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10952 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10953 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10954 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10955 | { } |
| 10956 | }; |
| 10957 | |
| 10958 | /* unsolicited event for HP jack sensing */ |
| 10959 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 10960 | unsigned int res) |
| 10961 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10962 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10963 | return; |
| 10964 | alc268_toshiba_automute(codec); |
| 10965 | } |
| 10966 | |
| 10967 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 10968 | unsigned int res) |
| 10969 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10970 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10971 | return; |
| 10972 | alc268_acer_automute(codec, 1); |
| 10973 | } |
| 10974 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10975 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 10976 | { |
| 10977 | alc268_acer_automute(codec, 1); |
| 10978 | } |
| 10979 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10980 | /* toggle speaker-output according to the hp-jack state */ |
| 10981 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 10982 | { |
| 10983 | unsigned int present; |
| 10984 | unsigned char bits; |
| 10985 | |
| 10986 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10987 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10988 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 10989 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 10990 | AMP_IN_MUTE(0), bits); |
| 10991 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 10992 | AMP_IN_MUTE(0), bits); |
| 10993 | } |
| 10994 | |
| 10995 | |
| 10996 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 10997 | { |
| 10998 | unsigned int present; |
| 10999 | |
| 11000 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11001 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11002 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11003 | present ? 0x0 : 0x6); |
| 11004 | } |
| 11005 | |
| 11006 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11007 | unsigned int res) |
| 11008 | { |
| 11009 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11010 | alc268_aspire_one_speaker_automute(codec); |
| 11011 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11012 | alc268_acer_mic_automute(codec); |
| 11013 | } |
| 11014 | |
| 11015 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11016 | { |
| 11017 | alc268_aspire_one_speaker_automute(codec); |
| 11018 | alc268_acer_mic_automute(codec); |
| 11019 | } |
| 11020 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11021 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11022 | /* output mixer control */ |
| 11023 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11024 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11025 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11026 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11027 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11028 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11029 | { } |
| 11030 | }; |
| 11031 | |
| 11032 | static struct hda_verb alc268_dell_verbs[] = { |
| 11033 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11034 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11035 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11036 | { } |
| 11037 | }; |
| 11038 | |
| 11039 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11040 | static void alc268_dell_automute(struct hda_codec *codec) |
| 11041 | { |
| 11042 | unsigned int present; |
| 11043 | unsigned int mute; |
| 11044 | |
| 11045 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 11046 | if (present & 0x80000000) |
| 11047 | mute = HDA_AMP_MUTE; |
| 11048 | else |
| 11049 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 11050 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11051 | HDA_AMP_MUTE, mute); |
| 11052 | } |
| 11053 | |
| 11054 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 11055 | unsigned int res) |
| 11056 | { |
| 11057 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11058 | return; |
| 11059 | alc268_dell_automute(codec); |
| 11060 | } |
| 11061 | |
| 11062 | #define alc268_dell_init_hook alc268_dell_automute |
| 11063 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11064 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11065 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11066 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11067 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11068 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11069 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11070 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11071 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11072 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11073 | { } |
| 11074 | }; |
| 11075 | |
| 11076 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11077 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11078 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11079 | { } |
| 11080 | }; |
| 11081 | |
| 11082 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 11083 | { |
| 11084 | unsigned int present; |
| 11085 | |
| 11086 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11087 | & AC_PINSENSE_PRESENCE; |
| 11088 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11089 | present ? 0 : PIN_OUT); |
| 11090 | } |
| 11091 | |
| 11092 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11093 | { |
| 11094 | unsigned int present; |
| 11095 | |
| 11096 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11097 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11098 | snd_hda_codec_write(codec, 0x23, 0, |
| 11099 | AC_VERB_SET_CONNECT_SEL, |
| 11100 | present ? 0x00 : 0x01); |
| 11101 | } |
| 11102 | |
| 11103 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 11104 | { |
| 11105 | alc267_quanta_il1_hp_automute(codec); |
| 11106 | alc267_quanta_il1_mic_automute(codec); |
| 11107 | } |
| 11108 | |
| 11109 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11110 | unsigned int res) |
| 11111 | { |
| 11112 | switch (res >> 26) { |
| 11113 | case ALC880_HP_EVENT: |
| 11114 | alc267_quanta_il1_hp_automute(codec); |
| 11115 | break; |
| 11116 | case ALC880_MIC_EVENT: |
| 11117 | alc267_quanta_il1_mic_automute(codec); |
| 11118 | break; |
| 11119 | } |
| 11120 | } |
| 11121 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11122 | /* |
| 11123 | * generic initialization of ADC, input mixers and output mixers |
| 11124 | */ |
| 11125 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11126 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11127 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11128 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11129 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11130 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11131 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11132 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11133 | |
| 11134 | /* |
| 11135 | * Set up output mixers (0x0c - 0x0e) |
| 11136 | */ |
| 11137 | /* set vol=0 to output mixers */ |
| 11138 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11139 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11140 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11141 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11142 | |
| 11143 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11144 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11145 | |
| 11146 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11147 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11148 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11149 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11150 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11151 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11152 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11153 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11154 | |
| 11155 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11156 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11157 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11158 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11159 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11160 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11161 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11162 | |
| 11163 | /* set PCBEEP vol = 0, mute connections */ |
| 11164 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11165 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11166 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11167 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11168 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11169 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11170 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11171 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11172 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11173 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11174 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11175 | { } |
| 11176 | }; |
| 11177 | |
| 11178 | /* |
| 11179 | * generic initialization of ADC, input mixers and output mixers |
| 11180 | */ |
| 11181 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11182 | /* set output DAC */ |
| 11183 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11184 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11185 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11186 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11187 | |
| 11188 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11189 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11190 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11191 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11192 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11193 | |
| 11194 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11195 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11196 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11197 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11198 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11199 | |
| 11200 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11201 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11202 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11203 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11204 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11205 | /* set PCBEEP vol = 0, mute connections */ |
| 11206 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11207 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11208 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11209 | |
| 11210 | { } |
| 11211 | }; |
| 11212 | |
| 11213 | #define alc268_mux_enum_info alc_mux_enum_info |
| 11214 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11215 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11216 | |
| 11217 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11218 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11219 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11220 | { |
| 11221 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11222 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11223 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11224 | */ |
| 11225 | /* .name = "Capture Source", */ |
| 11226 | .name = "Input Source", |
| 11227 | .count = 1, |
| 11228 | .info = alc268_mux_enum_info, |
| 11229 | .get = alc268_mux_enum_get, |
| 11230 | .put = alc268_mux_enum_put, |
| 11231 | }, |
| 11232 | { } /* end */ |
| 11233 | }; |
| 11234 | |
| 11235 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11236 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11237 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11238 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11239 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11240 | { |
| 11241 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11242 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11243 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11244 | */ |
| 11245 | /* .name = "Capture Source", */ |
| 11246 | .name = "Input Source", |
| 11247 | .count = 2, |
| 11248 | .info = alc268_mux_enum_info, |
| 11249 | .get = alc268_mux_enum_get, |
| 11250 | .put = alc268_mux_enum_put, |
| 11251 | }, |
| 11252 | { } /* end */ |
| 11253 | }; |
| 11254 | |
| 11255 | static struct hda_input_mux alc268_capture_source = { |
| 11256 | .num_items = 4, |
| 11257 | .items = { |
| 11258 | { "Mic", 0x0 }, |
| 11259 | { "Front Mic", 0x1 }, |
| 11260 | { "Line", 0x2 }, |
| 11261 | { "CD", 0x3 }, |
| 11262 | }, |
| 11263 | }; |
| 11264 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11265 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11266 | .num_items = 3, |
| 11267 | .items = { |
| 11268 | { "Mic", 0x0 }, |
| 11269 | { "Internal Mic", 0x6 }, |
| 11270 | { "Line", 0x2 }, |
| 11271 | }, |
| 11272 | }; |
| 11273 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11274 | #ifdef CONFIG_SND_DEBUG |
| 11275 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11276 | /* Volume widgets */ |
| 11277 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11278 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11279 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11280 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11281 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11282 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11283 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11284 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11285 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11286 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11287 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11288 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11289 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11290 | /* The below appears problematic on some hardwares */ |
| 11291 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11292 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11293 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11294 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11295 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11296 | |
| 11297 | /* Modes for retasking pin widgets */ |
| 11298 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11299 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11300 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11301 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11302 | |
| 11303 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11304 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11305 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11306 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11307 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11308 | |
| 11309 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11310 | * The ALC268 does not have an SPDIF input. |
| 11311 | */ |
| 11312 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11313 | |
| 11314 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11315 | * this output to turn on an external amplifier. |
| 11316 | */ |
| 11317 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11318 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11319 | |
| 11320 | { } /* end */ |
| 11321 | }; |
| 11322 | #endif |
| 11323 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11324 | /* create input playback/capture controls for the given pin */ |
| 11325 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11326 | const char *ctlname, int idx) |
| 11327 | { |
| 11328 | char name[32]; |
| 11329 | int err; |
| 11330 | |
| 11331 | sprintf(name, "%s Playback Volume", ctlname); |
| 11332 | if (nid == 0x14) { |
| 11333 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11334 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11335 | HDA_OUTPUT)); |
| 11336 | if (err < 0) |
| 11337 | return err; |
| 11338 | } else if (nid == 0x15) { |
| 11339 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11340 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11341 | HDA_OUTPUT)); |
| 11342 | if (err < 0) |
| 11343 | return err; |
| 11344 | } else |
| 11345 | return -1; |
| 11346 | sprintf(name, "%s Playback Switch", ctlname); |
| 11347 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11348 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11349 | if (err < 0) |
| 11350 | return err; |
| 11351 | return 0; |
| 11352 | } |
| 11353 | |
| 11354 | /* add playback controls from the parsed DAC table */ |
| 11355 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11356 | const struct auto_pin_cfg *cfg) |
| 11357 | { |
| 11358 | hda_nid_t nid; |
| 11359 | int err; |
| 11360 | |
| 11361 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11362 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11363 | spec->multiout.dac_nids[0] = 2; |
| 11364 | spec->multiout.dac_nids[1] = 3; |
| 11365 | |
| 11366 | nid = cfg->line_out_pins[0]; |
| 11367 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11368 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11369 | |
| 11370 | nid = cfg->speaker_pins[0]; |
| 11371 | if (nid == 0x1d) { |
| 11372 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11373 | "Speaker Playback Volume", |
| 11374 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11375 | if (err < 0) |
| 11376 | return err; |
| 11377 | } |
| 11378 | nid = cfg->hp_pins[0]; |
| 11379 | if (nid) |
| 11380 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11381 | |
| 11382 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11383 | if (nid == 0x16) { |
| 11384 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11385 | "Mono Playback Switch", |
| 11386 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11387 | if (err < 0) |
| 11388 | return err; |
| 11389 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11390 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11391 | } |
| 11392 | |
| 11393 | /* create playback/capture controls for input pins */ |
| 11394 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11395 | const struct auto_pin_cfg *cfg) |
| 11396 | { |
| 11397 | struct hda_input_mux *imux = &spec->private_imux; |
| 11398 | int i, idx1; |
| 11399 | |
| 11400 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11401 | switch(cfg->input_pins[i]) { |
| 11402 | case 0x18: |
| 11403 | idx1 = 0; /* Mic 1 */ |
| 11404 | break; |
| 11405 | case 0x19: |
| 11406 | idx1 = 1; /* Mic 2 */ |
| 11407 | break; |
| 11408 | case 0x1a: |
| 11409 | idx1 = 2; /* Line In */ |
| 11410 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11411 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11412 | idx1 = 3; /* CD */ |
| 11413 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11414 | case 0x12: |
| 11415 | case 0x13: |
| 11416 | idx1 = 6; /* digital mics */ |
| 11417 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11418 | default: |
| 11419 | continue; |
| 11420 | } |
| 11421 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11422 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11423 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11424 | } |
| 11425 | return 0; |
| 11426 | } |
| 11427 | |
| 11428 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11429 | { |
| 11430 | struct alc_spec *spec = codec->spec; |
| 11431 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11432 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11433 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11434 | unsigned int dac_vol1, dac_vol2; |
| 11435 | |
| 11436 | if (speaker_nid) { |
| 11437 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11438 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11439 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11440 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11441 | AMP_IN_UNMUTE(1)); |
| 11442 | snd_hda_codec_write(codec, 0x10, 0, |
| 11443 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11444 | AMP_IN_UNMUTE(1)); |
| 11445 | } else { |
| 11446 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11447 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11448 | snd_hda_codec_write(codec, 0x10, 0, |
| 11449 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11450 | } |
| 11451 | |
| 11452 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11453 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11454 | dac_vol2 = AMP_OUT_ZERO; |
| 11455 | else if (line_nid == 0x15) |
| 11456 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11457 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11458 | dac_vol2 = AMP_OUT_ZERO; |
| 11459 | else if (hp_nid == 0x15) |
| 11460 | dac_vol1 = AMP_OUT_ZERO; |
| 11461 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11462 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11463 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11464 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11465 | |
| 11466 | snd_hda_codec_write(codec, 0x02, 0, |
| 11467 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11468 | snd_hda_codec_write(codec, 0x03, 0, |
| 11469 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11470 | } |
| 11471 | |
| 11472 | /* pcm configuration: identiacal with ALC880 */ |
| 11473 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11474 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11475 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11476 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11477 | |
| 11478 | /* |
| 11479 | * BIOS auto configuration |
| 11480 | */ |
| 11481 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11482 | { |
| 11483 | struct alc_spec *spec = codec->spec; |
| 11484 | int err; |
| 11485 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11486 | |
| 11487 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11488 | alc268_ignore); |
| 11489 | if (err < 0) |
| 11490 | return err; |
| 11491 | if (!spec->autocfg.line_outs) |
| 11492 | return 0; /* can't find valid BIOS pin config */ |
| 11493 | |
| 11494 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11495 | if (err < 0) |
| 11496 | return err; |
| 11497 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11498 | if (err < 0) |
| 11499 | return err; |
| 11500 | |
| 11501 | spec->multiout.max_channels = 2; |
| 11502 | |
| 11503 | /* digital only support output */ |
| 11504 | if (spec->autocfg.dig_out_pin) |
| 11505 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 11506 | |
| 11507 | if (spec->kctl_alloc) |
| 11508 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11509 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11510 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 11511 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 11512 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11513 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 11514 | spec->num_mux_defs = 1; |
| 11515 | spec->input_mux = &spec->private_imux; |
| 11516 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11517 | err = alc_auto_add_mic_boost(codec); |
| 11518 | if (err < 0) |
| 11519 | return err; |
| 11520 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame^] | 11521 | store_pin_configs(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11522 | return 1; |
| 11523 | } |
| 11524 | |
| 11525 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11526 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11527 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11528 | |
| 11529 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11530 | static void alc268_auto_init(struct hda_codec *codec) |
| 11531 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11532 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11533 | alc268_auto_init_multi_out(codec); |
| 11534 | alc268_auto_init_hp_out(codec); |
| 11535 | alc268_auto_init_mono_speaker_out(codec); |
| 11536 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11537 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11538 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11539 | } |
| 11540 | |
| 11541 | /* |
| 11542 | * configuration and preset |
| 11543 | */ |
| 11544 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11545 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11546 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11547 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11548 | [ALC268_ACER] = "acer", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11549 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11550 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11551 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11552 | #ifdef CONFIG_SND_DEBUG |
| 11553 | [ALC268_TEST] = "test", |
| 11554 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11555 | [ALC268_AUTO] = "auto", |
| 11556 | }; |
| 11557 | |
| 11558 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 11559 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11560 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11561 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11562 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11563 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11564 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 11565 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11566 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11567 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11568 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11569 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11570 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 11571 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11572 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11573 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11574 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11575 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11576 | {} |
| 11577 | }; |
| 11578 | |
| 11579 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11580 | [ALC267_QUANTA_IL1] = { |
| 11581 | .mixers = { alc267_quanta_il1_mixer }, |
| 11582 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11583 | alc267_quanta_il1_verbs }, |
| 11584 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11585 | .dac_nids = alc268_dac_nids, |
| 11586 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11587 | .adc_nids = alc268_adc_nids_alt, |
| 11588 | .hp_nid = 0x03, |
| 11589 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11590 | .channel_mode = alc268_modes, |
| 11591 | .input_mux = &alc268_capture_source, |
| 11592 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 11593 | .init_hook = alc267_quanta_il1_automute, |
| 11594 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11595 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11596 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11597 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11598 | .init_verbs = { alc268_base_init_verbs }, |
| 11599 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11600 | .dac_nids = alc268_dac_nids, |
| 11601 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11602 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11603 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11604 | .hp_nid = 0x03, |
| 11605 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11606 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11607 | .channel_mode = alc268_modes, |
| 11608 | .input_mux = &alc268_capture_source, |
| 11609 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11610 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11611 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11612 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11613 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11614 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11615 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11616 | .dac_nids = alc268_dac_nids, |
| 11617 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11618 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11619 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11620 | .hp_nid = 0x03, |
| 11621 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11622 | .channel_mode = alc268_modes, |
| 11623 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11624 | .unsol_event = alc268_toshiba_unsol_event, |
| 11625 | .init_hook = alc268_toshiba_automute, |
| 11626 | }, |
| 11627 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11628 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 11629 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11630 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11631 | alc268_acer_verbs }, |
| 11632 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11633 | .dac_nids = alc268_dac_nids, |
| 11634 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11635 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11636 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11637 | .hp_nid = 0x02, |
| 11638 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11639 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11640 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11641 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11642 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11643 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11644 | [ALC268_ACER_ASPIRE_ONE] = { |
| 11645 | .mixers = { alc268_acer_aspire_one_mixer, |
| 11646 | alc268_capture_alt_mixer }, |
| 11647 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11648 | alc268_acer_aspire_one_verbs }, |
| 11649 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11650 | .dac_nids = alc268_dac_nids, |
| 11651 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11652 | .adc_nids = alc268_adc_nids_alt, |
| 11653 | .capsrc_nids = alc268_capsrc_nids, |
| 11654 | .hp_nid = 0x03, |
| 11655 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11656 | .channel_mode = alc268_modes, |
| 11657 | .input_mux = &alc268_acer_lc_capture_source, |
| 11658 | .unsol_event = alc268_acer_lc_unsol_event, |
| 11659 | .init_hook = alc268_acer_lc_init_hook, |
| 11660 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11661 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11662 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11663 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11664 | alc268_dell_verbs }, |
| 11665 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11666 | .dac_nids = alc268_dac_nids, |
| 11667 | .hp_nid = 0x02, |
| 11668 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11669 | .channel_mode = alc268_modes, |
| 11670 | .unsol_event = alc268_dell_unsol_event, |
| 11671 | .init_hook = alc268_dell_init_hook, |
| 11672 | .input_mux = &alc268_capture_source, |
| 11673 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11674 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11675 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11676 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11677 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11678 | alc268_toshiba_verbs }, |
| 11679 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11680 | .dac_nids = alc268_dac_nids, |
| 11681 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11682 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11683 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11684 | .hp_nid = 0x03, |
| 11685 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11686 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11687 | .channel_mode = alc268_modes, |
| 11688 | .input_mux = &alc268_capture_source, |
| 11689 | .unsol_event = alc268_toshiba_unsol_event, |
| 11690 | .init_hook = alc268_toshiba_automute |
| 11691 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11692 | #ifdef CONFIG_SND_DEBUG |
| 11693 | [ALC268_TEST] = { |
| 11694 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 11695 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11696 | alc268_volume_init_verbs }, |
| 11697 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11698 | .dac_nids = alc268_dac_nids, |
| 11699 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11700 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11701 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11702 | .hp_nid = 0x03, |
| 11703 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11704 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11705 | .channel_mode = alc268_modes, |
| 11706 | .input_mux = &alc268_capture_source, |
| 11707 | }, |
| 11708 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11709 | }; |
| 11710 | |
| 11711 | static int patch_alc268(struct hda_codec *codec) |
| 11712 | { |
| 11713 | struct alc_spec *spec; |
| 11714 | int board_config; |
| 11715 | int err; |
| 11716 | |
| 11717 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 11718 | if (spec == NULL) |
| 11719 | return -ENOMEM; |
| 11720 | |
| 11721 | codec->spec = spec; |
| 11722 | |
| 11723 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 11724 | alc268_models, |
| 11725 | alc268_cfg_tbl); |
| 11726 | |
| 11727 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 11728 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 11729 | "trying auto-probe from BIOS...\n"); |
| 11730 | board_config = ALC268_AUTO; |
| 11731 | } |
| 11732 | |
| 11733 | if (board_config == ALC268_AUTO) { |
| 11734 | /* automatic parse from the BIOS config */ |
| 11735 | err = alc268_parse_auto_config(codec); |
| 11736 | if (err < 0) { |
| 11737 | alc_free(codec); |
| 11738 | return err; |
| 11739 | } else if (!err) { |
| 11740 | printk(KERN_INFO |
| 11741 | "hda_codec: Cannot set up configuration " |
| 11742 | "from BIOS. Using base mode...\n"); |
| 11743 | board_config = ALC268_3ST; |
| 11744 | } |
| 11745 | } |
| 11746 | |
| 11747 | if (board_config != ALC268_AUTO) |
| 11748 | setup_preset(spec, &alc268_presets[board_config]); |
| 11749 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11750 | if (codec->vendor_id == 0x10ec0267) { |
| 11751 | spec->stream_name_analog = "ALC267 Analog"; |
| 11752 | spec->stream_name_digital = "ALC267 Digital"; |
| 11753 | } else { |
| 11754 | spec->stream_name_analog = "ALC268 Analog"; |
| 11755 | spec->stream_name_digital = "ALC268 Digital"; |
| 11756 | } |
| 11757 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11758 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 11759 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11760 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11761 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11762 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 11763 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11764 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 11765 | /* override the amp caps for beep generator */ |
| 11766 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 11767 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 11768 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 11769 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 11770 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 11771 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11772 | if (!spec->adc_nids && spec->input_mux) { |
| 11773 | /* check whether NID 0x07 is valid */ |
| 11774 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11775 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11776 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11777 | /* get type */ |
| 11778 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 11779 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11780 | spec->adc_nids = alc268_adc_nids_alt; |
| 11781 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 11782 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11783 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11784 | spec->num_mixers++; |
| 11785 | } else { |
| 11786 | spec->adc_nids = alc268_adc_nids; |
| 11787 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 11788 | spec->mixers[spec->num_mixers] = |
| 11789 | alc268_capture_mixer; |
| 11790 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11791 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11792 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11793 | /* set default input source */ |
| 11794 | for (i = 0; i < spec->num_adc_nids; i++) |
| 11795 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 11796 | 0, AC_VERB_SET_CONNECT_SEL, |
| 11797 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11798 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11799 | |
| 11800 | spec->vmaster_nid = 0x02; |
| 11801 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11802 | codec->patch_ops = alc_patch_ops; |
| 11803 | if (board_config == ALC268_AUTO) |
| 11804 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11805 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11806 | return 0; |
| 11807 | } |
| 11808 | |
| 11809 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11810 | * ALC269 channel source setting (2 channel) |
| 11811 | */ |
| 11812 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 11813 | |
| 11814 | #define alc269_dac_nids alc260_dac_nids |
| 11815 | |
| 11816 | static hda_nid_t alc269_adc_nids[1] = { |
| 11817 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11818 | 0x08, |
| 11819 | }; |
| 11820 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 11821 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 11822 | 0x23, |
| 11823 | }; |
| 11824 | |
| 11825 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 11826 | * not a mux! |
| 11827 | */ |
| 11828 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11829 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 11830 | .num_items = 2, |
| 11831 | .items = { |
| 11832 | { "i-Mic", 0x5 }, |
| 11833 | { "e-Mic", 0x0 }, |
| 11834 | }, |
| 11835 | }; |
| 11836 | |
| 11837 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 11838 | .num_items = 2, |
| 11839 | .items = { |
| 11840 | { "i-Mic", 0x1 }, |
| 11841 | { "e-Mic", 0x0 }, |
| 11842 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11843 | }; |
| 11844 | |
| 11845 | #define alc269_modes alc260_modes |
| 11846 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 11847 | |
| 11848 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 11849 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11850 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11851 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11852 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11853 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11854 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11855 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11856 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11857 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11858 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11859 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11860 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11861 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11862 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 11863 | { } /* end */ |
| 11864 | }; |
| 11865 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11866 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 11867 | /* output mixer control */ |
| 11868 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11869 | { |
| 11870 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11871 | .name = "Master Playback Switch", |
| 11872 | .info = snd_hda_mixer_amp_switch_info, |
| 11873 | .get = snd_hda_mixer_amp_switch_get, |
| 11874 | .put = alc268_acer_master_sw_put, |
| 11875 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11876 | }, |
| 11877 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11878 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11879 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11880 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11881 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11882 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11883 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11884 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11885 | { } |
| 11886 | }; |
| 11887 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11888 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 11889 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 11890 | .ops = &snd_hda_bind_vol, |
| 11891 | .values = { |
| 11892 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11893 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11894 | 0 |
| 11895 | }, |
| 11896 | }; |
| 11897 | |
| 11898 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 11899 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11900 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 11901 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11902 | { } /* end */ |
| 11903 | }; |
| 11904 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11905 | /* capture mixer elements */ |
| 11906 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11907 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11908 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11909 | { |
| 11910 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11911 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11912 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11913 | */ |
| 11914 | /* .name = "Capture Source", */ |
| 11915 | .name = "Input Source", |
| 11916 | .count = 1, |
| 11917 | .info = alc_mux_enum_info, |
| 11918 | .get = alc_mux_enum_get, |
| 11919 | .put = alc_mux_enum_put, |
| 11920 | }, |
| 11921 | { } /* end */ |
| 11922 | }; |
| 11923 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11924 | /* capture mixer elements */ |
| 11925 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 11926 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11927 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11928 | { } /* end */ |
| 11929 | }; |
| 11930 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11931 | /* beep control */ |
| 11932 | static struct snd_kcontrol_new alc269_beep_mixer[] = { |
| 11933 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11934 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
| 11935 | { } /* end */ |
| 11936 | }; |
| 11937 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11938 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 11939 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11940 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11941 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11942 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11943 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11944 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11945 | { } |
| 11946 | }; |
| 11947 | |
| 11948 | /* toggle speaker-output according to the hp-jack state */ |
| 11949 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 11950 | { |
| 11951 | unsigned int present; |
| 11952 | unsigned char bits; |
| 11953 | |
| 11954 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11955 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11956 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11957 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11958 | AMP_IN_MUTE(0), bits); |
| 11959 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11960 | AMP_IN_MUTE(0), bits); |
| 11961 | |
| 11962 | snd_hda_codec_write(codec, 0x20, 0, |
| 11963 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11964 | snd_hda_codec_write(codec, 0x20, 0, |
| 11965 | AC_VERB_SET_PROC_COEF, 0x680); |
| 11966 | |
| 11967 | snd_hda_codec_write(codec, 0x20, 0, |
| 11968 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11969 | snd_hda_codec_write(codec, 0x20, 0, |
| 11970 | AC_VERB_SET_PROC_COEF, 0x480); |
| 11971 | } |
| 11972 | |
| 11973 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 11974 | { |
| 11975 | unsigned int present; |
| 11976 | |
| 11977 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11978 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11979 | snd_hda_codec_write(codec, 0x23, 0, |
| 11980 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 11981 | } |
| 11982 | |
| 11983 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 11984 | unsigned int res) |
| 11985 | { |
| 11986 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11987 | alc269_quanta_fl1_speaker_automute(codec); |
| 11988 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11989 | alc269_quanta_fl1_mic_automute(codec); |
| 11990 | } |
| 11991 | |
| 11992 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 11993 | { |
| 11994 | alc269_quanta_fl1_speaker_automute(codec); |
| 11995 | alc269_quanta_fl1_mic_automute(codec); |
| 11996 | } |
| 11997 | |
| 11998 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 11999 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12000 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12001 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12002 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12003 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12004 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12005 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12006 | {} |
| 12007 | }; |
| 12008 | |
| 12009 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12010 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12011 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12012 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12013 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12014 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12015 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12016 | {} |
| 12017 | }; |
| 12018 | |
| 12019 | /* toggle speaker-output according to the hp-jack state */ |
| 12020 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12021 | { |
| 12022 | unsigned int present; |
| 12023 | unsigned char bits; |
| 12024 | |
| 12025 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12026 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12027 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12028 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12029 | AMP_IN_MUTE(0), bits); |
| 12030 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12031 | AMP_IN_MUTE(0), bits); |
| 12032 | } |
| 12033 | |
| 12034 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12035 | { |
| 12036 | unsigned int present; |
| 12037 | |
| 12038 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12039 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12040 | snd_hda_codec_write(codec, 0x23, 0, |
| 12041 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12042 | } |
| 12043 | |
| 12044 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12045 | { |
| 12046 | unsigned int present; |
| 12047 | |
| 12048 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12049 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12050 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12051 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12052 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12053 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12054 | } |
| 12055 | |
| 12056 | /* unsolicited event for HP jack sensing */ |
| 12057 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12058 | unsigned int res) |
| 12059 | { |
| 12060 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12061 | alc269_speaker_automute(codec); |
| 12062 | |
| 12063 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12064 | alc269_eeepc_dmic_automute(codec); |
| 12065 | } |
| 12066 | |
| 12067 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12068 | { |
| 12069 | alc269_speaker_automute(codec); |
| 12070 | alc269_eeepc_dmic_automute(codec); |
| 12071 | } |
| 12072 | |
| 12073 | /* unsolicited event for HP jack sensing */ |
| 12074 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12075 | unsigned int res) |
| 12076 | { |
| 12077 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12078 | alc269_speaker_automute(codec); |
| 12079 | |
| 12080 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12081 | alc269_eeepc_amic_automute(codec); |
| 12082 | } |
| 12083 | |
| 12084 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12085 | { |
| 12086 | alc269_speaker_automute(codec); |
| 12087 | alc269_eeepc_amic_automute(codec); |
| 12088 | } |
| 12089 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12090 | /* |
| 12091 | * generic initialization of ADC, input mixers and output mixers |
| 12092 | */ |
| 12093 | static struct hda_verb alc269_init_verbs[] = { |
| 12094 | /* |
| 12095 | * Unmute ADC0 and set the default input to mic-in |
| 12096 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12097 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12098 | |
| 12099 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12100 | * analog-loopback mixer widget |
| 12101 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12102 | * front panel mic (mic 2) |
| 12103 | */ |
| 12104 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12105 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12106 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12107 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12108 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12109 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12110 | |
| 12111 | /* |
| 12112 | * Set up output mixers (0x0c - 0x0e) |
| 12113 | */ |
| 12114 | /* set vol=0 to output mixers */ |
| 12115 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12116 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12117 | |
| 12118 | /* set up input amps for analog loopback */ |
| 12119 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12120 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12121 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12122 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12123 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12124 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12125 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12126 | |
| 12127 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12128 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12129 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12130 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12131 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12132 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12133 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12134 | |
| 12135 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12136 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12137 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12138 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12139 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12140 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12141 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12142 | |
| 12143 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12144 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12145 | |
| 12146 | /* FIXME: use matrix-type input source selection */ |
| 12147 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12148 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12149 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12150 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12151 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12152 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12153 | |
| 12154 | /* set EAPD */ |
| 12155 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12156 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12157 | { } |
| 12158 | }; |
| 12159 | |
| 12160 | /* add playback controls from the parsed DAC table */ |
| 12161 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12162 | const struct auto_pin_cfg *cfg) |
| 12163 | { |
| 12164 | hda_nid_t nid; |
| 12165 | int err; |
| 12166 | |
| 12167 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12168 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12169 | spec->multiout.dac_nids[0] = 2; |
| 12170 | |
| 12171 | nid = cfg->line_out_pins[0]; |
| 12172 | if (nid) { |
| 12173 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12174 | "Front Playback Volume", |
| 12175 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12176 | if (err < 0) |
| 12177 | return err; |
| 12178 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12179 | "Front Playback Switch", |
| 12180 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12181 | if (err < 0) |
| 12182 | return err; |
| 12183 | } |
| 12184 | |
| 12185 | nid = cfg->speaker_pins[0]; |
| 12186 | if (nid) { |
| 12187 | if (!cfg->line_out_pins[0]) { |
| 12188 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12189 | "Speaker Playback Volume", |
| 12190 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12191 | HDA_OUTPUT)); |
| 12192 | if (err < 0) |
| 12193 | return err; |
| 12194 | } |
| 12195 | if (nid == 0x16) { |
| 12196 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12197 | "Speaker Playback Switch", |
| 12198 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12199 | HDA_OUTPUT)); |
| 12200 | if (err < 0) |
| 12201 | return err; |
| 12202 | } else { |
| 12203 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12204 | "Speaker Playback Switch", |
| 12205 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12206 | HDA_OUTPUT)); |
| 12207 | if (err < 0) |
| 12208 | return err; |
| 12209 | } |
| 12210 | } |
| 12211 | nid = cfg->hp_pins[0]; |
| 12212 | if (nid) { |
| 12213 | /* spec->multiout.hp_nid = 2; */ |
| 12214 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12215 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12216 | "Headphone Playback Volume", |
| 12217 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12218 | HDA_OUTPUT)); |
| 12219 | if (err < 0) |
| 12220 | return err; |
| 12221 | } |
| 12222 | if (nid == 0x16) { |
| 12223 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12224 | "Headphone Playback Switch", |
| 12225 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12226 | HDA_OUTPUT)); |
| 12227 | if (err < 0) |
| 12228 | return err; |
| 12229 | } else { |
| 12230 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12231 | "Headphone Playback Switch", |
| 12232 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12233 | HDA_OUTPUT)); |
| 12234 | if (err < 0) |
| 12235 | return err; |
| 12236 | } |
| 12237 | } |
| 12238 | return 0; |
| 12239 | } |
| 12240 | |
| 12241 | #define alc269_auto_create_analog_input_ctls \ |
| 12242 | alc880_auto_create_analog_input_ctls |
| 12243 | |
| 12244 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12245 | #define alc269_loopbacks alc880_loopbacks |
| 12246 | #endif |
| 12247 | |
| 12248 | /* pcm configuration: identiacal with ALC880 */ |
| 12249 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12250 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12251 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12252 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12253 | |
| 12254 | /* |
| 12255 | * BIOS auto configuration |
| 12256 | */ |
| 12257 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12258 | { |
| 12259 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12260 | int i, err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12261 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12262 | |
| 12263 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12264 | alc269_ignore); |
| 12265 | if (err < 0) |
| 12266 | return err; |
| 12267 | |
| 12268 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12269 | if (err < 0) |
| 12270 | return err; |
| 12271 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12272 | if (err < 0) |
| 12273 | return err; |
| 12274 | |
| 12275 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12276 | |
| 12277 | if (spec->autocfg.dig_out_pin) |
| 12278 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12279 | |
| 12280 | if (spec->kctl_alloc) |
| 12281 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12282 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12283 | /* create a beep mixer control if the pin 0x1d isn't assigned */ |
| 12284 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) |
| 12285 | if (spec->autocfg.input_pins[i] == 0x1d) |
| 12286 | break; |
| 12287 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) |
| 12288 | spec->mixers[spec->num_mixers++] = alc269_beep_mixer; |
| 12289 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12290 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 12291 | spec->num_mux_defs = 1; |
| 12292 | spec->input_mux = &spec->private_imux; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12293 | /* set default input source */ |
| 12294 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12295 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12296 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12297 | |
| 12298 | err = alc_auto_add_mic_boost(codec); |
| 12299 | if (err < 0) |
| 12300 | return err; |
| 12301 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12302 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 12303 | spec->num_mixers++; |
| 12304 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame^] | 12305 | store_pin_configs(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12306 | return 1; |
| 12307 | } |
| 12308 | |
| 12309 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12310 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12311 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12312 | |
| 12313 | |
| 12314 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12315 | static void alc269_auto_init(struct hda_codec *codec) |
| 12316 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12317 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12318 | alc269_auto_init_multi_out(codec); |
| 12319 | alc269_auto_init_hp_out(codec); |
| 12320 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12321 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12322 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12323 | } |
| 12324 | |
| 12325 | /* |
| 12326 | * configuration and preset |
| 12327 | */ |
| 12328 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12329 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12330 | [ALC269_QUANTA_FL1] = "quanta", |
| 12331 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
| 12332 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12333 | }; |
| 12334 | |
| 12335 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12336 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12337 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12338 | ALC269_ASUS_EEEPC_P703), |
| 12339 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12340 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12341 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12342 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12343 | {} |
| 12344 | }; |
| 12345 | |
| 12346 | static struct alc_config_preset alc269_presets[] = { |
| 12347 | [ALC269_BASIC] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12348 | .mixers = { alc269_base_mixer, alc269_capture_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12349 | .init_verbs = { alc269_init_verbs }, |
| 12350 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12351 | .dac_nids = alc269_dac_nids, |
| 12352 | .hp_nid = 0x03, |
| 12353 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12354 | .channel_mode = alc269_modes, |
| 12355 | .input_mux = &alc269_capture_source, |
| 12356 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12357 | [ALC269_QUANTA_FL1] = { |
| 12358 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12359 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12360 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12361 | .dac_nids = alc269_dac_nids, |
| 12362 | .hp_nid = 0x03, |
| 12363 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12364 | .channel_mode = alc269_modes, |
| 12365 | .input_mux = &alc269_capture_source, |
| 12366 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12367 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12368 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12369 | [ALC269_ASUS_EEEPC_P703] = { |
| 12370 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, |
| 12371 | .init_verbs = { alc269_init_verbs, |
| 12372 | alc269_eeepc_amic_init_verbs }, |
| 12373 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12374 | .dac_nids = alc269_dac_nids, |
| 12375 | .hp_nid = 0x03, |
| 12376 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12377 | .channel_mode = alc269_modes, |
| 12378 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12379 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12380 | .init_hook = alc269_eeepc_amic_inithook, |
| 12381 | }, |
| 12382 | [ALC269_ASUS_EEEPC_P901] = { |
| 12383 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer}, |
| 12384 | .init_verbs = { alc269_init_verbs, |
| 12385 | alc269_eeepc_dmic_init_verbs }, |
| 12386 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12387 | .dac_nids = alc269_dac_nids, |
| 12388 | .hp_nid = 0x03, |
| 12389 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12390 | .channel_mode = alc269_modes, |
| 12391 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12392 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12393 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12394 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12395 | }; |
| 12396 | |
| 12397 | static int patch_alc269(struct hda_codec *codec) |
| 12398 | { |
| 12399 | struct alc_spec *spec; |
| 12400 | int board_config; |
| 12401 | int err; |
| 12402 | |
| 12403 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12404 | if (spec == NULL) |
| 12405 | return -ENOMEM; |
| 12406 | |
| 12407 | codec->spec = spec; |
| 12408 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12409 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 12410 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12411 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 12412 | alc269_models, |
| 12413 | alc269_cfg_tbl); |
| 12414 | |
| 12415 | if (board_config < 0) { |
| 12416 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 12417 | "trying auto-probe from BIOS...\n"); |
| 12418 | board_config = ALC269_AUTO; |
| 12419 | } |
| 12420 | |
| 12421 | if (board_config == ALC269_AUTO) { |
| 12422 | /* automatic parse from the BIOS config */ |
| 12423 | err = alc269_parse_auto_config(codec); |
| 12424 | if (err < 0) { |
| 12425 | alc_free(codec); |
| 12426 | return err; |
| 12427 | } else if (!err) { |
| 12428 | printk(KERN_INFO |
| 12429 | "hda_codec: Cannot set up configuration " |
| 12430 | "from BIOS. Using base mode...\n"); |
| 12431 | board_config = ALC269_BASIC; |
| 12432 | } |
| 12433 | } |
| 12434 | |
| 12435 | if (board_config != ALC269_AUTO) |
| 12436 | setup_preset(spec, &alc269_presets[board_config]); |
| 12437 | |
| 12438 | spec->stream_name_analog = "ALC269 Analog"; |
| 12439 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 12440 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 12441 | |
| 12442 | spec->stream_name_digital = "ALC269 Digital"; |
| 12443 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 12444 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 12445 | |
| 12446 | spec->adc_nids = alc269_adc_nids; |
| 12447 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12448 | spec->capsrc_nids = alc269_capsrc_nids; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12449 | |
| 12450 | codec->patch_ops = alc_patch_ops; |
| 12451 | if (board_config == ALC269_AUTO) |
| 12452 | spec->init_hook = alc269_auto_init; |
| 12453 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12454 | if (!spec->loopback.amplist) |
| 12455 | spec->loopback.amplist = alc269_loopbacks; |
| 12456 | #endif |
| 12457 | |
| 12458 | return 0; |
| 12459 | } |
| 12460 | |
| 12461 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12462 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 12463 | */ |
| 12464 | |
| 12465 | /* |
| 12466 | * set the path ways for 2 channel output |
| 12467 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 12468 | */ |
| 12469 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 12470 | /* set pin widget 1Ah (line in) for input */ |
| 12471 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12472 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12473 | * the vref |
| 12474 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12475 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12476 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12477 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12478 | #if 0 |
| 12479 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12480 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12481 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12482 | { } /* end */ |
| 12483 | }; |
| 12484 | /* |
| 12485 | * 6ch mode |
| 12486 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 12487 | */ |
| 12488 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 12489 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12490 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12491 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12492 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12493 | |
| 12494 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12495 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12496 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12497 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12498 | #if 0 |
| 12499 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12500 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12501 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12502 | { } /* end */ |
| 12503 | }; |
| 12504 | |
| 12505 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 12506 | { 2, alc861_threestack_ch2_init }, |
| 12507 | { 6, alc861_threestack_ch6_init }, |
| 12508 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12509 | /* Set mic1 as input and unmute the mixer */ |
| 12510 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 12511 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12512 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12513 | { } /* end */ |
| 12514 | }; |
| 12515 | /* Set mic1 as output and mute mixer */ |
| 12516 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 12517 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12518 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12519 | { } /* end */ |
| 12520 | }; |
| 12521 | |
| 12522 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 12523 | { 2, alc861_uniwill_m31_ch2_init }, |
| 12524 | { 4, alc861_uniwill_m31_ch4_init }, |
| 12525 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12526 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12527 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 12528 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 12529 | /* set pin widget 1Ah (line in) for input */ |
| 12530 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12531 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12532 | * the vref |
| 12533 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12534 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12535 | |
| 12536 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12537 | #if 0 |
| 12538 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12539 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12540 | #endif |
| 12541 | { } /* end */ |
| 12542 | }; |
| 12543 | /* Set mic1 nad line-in as output and mute mixer */ |
| 12544 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 12545 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12546 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12547 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12548 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12549 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12550 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12551 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12552 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12553 | |
| 12554 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12555 | #if 0 |
| 12556 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12557 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12558 | #endif |
| 12559 | { } /* end */ |
| 12560 | }; |
| 12561 | |
| 12562 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 12563 | { 2, alc861_asus_ch2_init }, |
| 12564 | { 6, alc861_asus_ch6_init }, |
| 12565 | }; |
| 12566 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12567 | /* patch-ALC861 */ |
| 12568 | |
| 12569 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 12570 | /* output mixer control */ |
| 12571 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12572 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12573 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12574 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12575 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12576 | |
| 12577 | /*Input mixer control */ |
| 12578 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12579 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12580 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12581 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12582 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12583 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12584 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12585 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12586 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12587 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12588 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12589 | /* Capture mixer control */ |
| 12590 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12591 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12592 | { |
| 12593 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12594 | .name = "Capture Source", |
| 12595 | .count = 1, |
| 12596 | .info = alc_mux_enum_info, |
| 12597 | .get = alc_mux_enum_get, |
| 12598 | .put = alc_mux_enum_put, |
| 12599 | }, |
| 12600 | { } /* end */ |
| 12601 | }; |
| 12602 | |
| 12603 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 12604 | /* output mixer control */ |
| 12605 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12606 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12607 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12608 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12609 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12610 | |
| 12611 | /* Input mixer control */ |
| 12612 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12613 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12614 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12615 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12616 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12617 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12618 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12619 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12620 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12621 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12622 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12623 | /* Capture mixer control */ |
| 12624 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12625 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12626 | { |
| 12627 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12628 | .name = "Capture Source", |
| 12629 | .count = 1, |
| 12630 | .info = alc_mux_enum_info, |
| 12631 | .get = alc_mux_enum_get, |
| 12632 | .put = alc_mux_enum_put, |
| 12633 | }, |
| 12634 | { |
| 12635 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12636 | .name = "Channel Mode", |
| 12637 | .info = alc_ch_mode_info, |
| 12638 | .get = alc_ch_mode_get, |
| 12639 | .put = alc_ch_mode_put, |
| 12640 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 12641 | }, |
| 12642 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12643 | }; |
| 12644 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12645 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12646 | /* output mixer control */ |
| 12647 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12648 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12649 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12650 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12651 | /*Capture mixer control */ |
| 12652 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12653 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12654 | { |
| 12655 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12656 | .name = "Capture Source", |
| 12657 | .count = 1, |
| 12658 | .info = alc_mux_enum_info, |
| 12659 | .get = alc_mux_enum_get, |
| 12660 | .put = alc_mux_enum_put, |
| 12661 | }, |
| 12662 | |
| 12663 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12664 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12665 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12666 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 12667 | /* output mixer control */ |
| 12668 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12669 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12670 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12671 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12672 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12673 | |
| 12674 | /* Input mixer control */ |
| 12675 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12676 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12677 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12678 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12679 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12680 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12682 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12683 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12684 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12685 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12686 | /* Capture mixer control */ |
| 12687 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12688 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12689 | { |
| 12690 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12691 | .name = "Capture Source", |
| 12692 | .count = 1, |
| 12693 | .info = alc_mux_enum_info, |
| 12694 | .get = alc_mux_enum_get, |
| 12695 | .put = alc_mux_enum_put, |
| 12696 | }, |
| 12697 | { |
| 12698 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12699 | .name = "Channel Mode", |
| 12700 | .info = alc_ch_mode_info, |
| 12701 | .get = alc_ch_mode_get, |
| 12702 | .put = alc_ch_mode_put, |
| 12703 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12704 | }, |
| 12705 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12706 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12707 | |
| 12708 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 12709 | /* output mixer control */ |
| 12710 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12711 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12712 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12713 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12714 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12715 | |
| 12716 | /* Input mixer control */ |
| 12717 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12718 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12719 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12720 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12721 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12722 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12723 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12724 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12725 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12726 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 12727 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12728 | /* Capture mixer control */ |
| 12729 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12730 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12731 | { |
| 12732 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12733 | .name = "Capture Source", |
| 12734 | .count = 1, |
| 12735 | .info = alc_mux_enum_info, |
| 12736 | .get = alc_mux_enum_get, |
| 12737 | .put = alc_mux_enum_put, |
| 12738 | }, |
| 12739 | { |
| 12740 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12741 | .name = "Channel Mode", |
| 12742 | .info = alc_ch_mode_info, |
| 12743 | .get = alc_ch_mode_get, |
| 12744 | .put = alc_ch_mode_put, |
| 12745 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 12746 | }, |
| 12747 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12748 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12749 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12750 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12751 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12752 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12753 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12754 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12755 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12756 | { } |
| 12757 | }; |
| 12758 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12759 | /* |
| 12760 | * generic initialization of ADC, input mixers and output mixers |
| 12761 | */ |
| 12762 | static struct hda_verb alc861_base_init_verbs[] = { |
| 12763 | /* |
| 12764 | * Unmute ADC0 and set the default input to mic-in |
| 12765 | */ |
| 12766 | /* port-A for surround (rear panel) */ |
| 12767 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12768 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12769 | /* port-B for mic-in (rear panel) with vref */ |
| 12770 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12771 | /* port-C for line-in (rear panel) */ |
| 12772 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12773 | /* port-D for Front */ |
| 12774 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12775 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12776 | /* port-E for HP out (front panel) */ |
| 12777 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12778 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12779 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12780 | /* port-F for mic-in (front panel) with vref */ |
| 12781 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12782 | /* port-G for CLFE (rear panel) */ |
| 12783 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12784 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12785 | /* port-H for side (rear panel) */ |
| 12786 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12787 | { 0x20, AC_VERB_SET_CONNECT_SEL, 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)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12793 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12794 | /* Unmute DAC0~3 & spdif out*/ |
| 12795 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12796 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12797 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12798 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12799 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12800 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12801 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12802 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12803 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12804 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12805 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12806 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12807 | /* Unmute Stereo Mixer 15 */ |
| 12808 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12809 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12810 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12811 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12812 | |
| 12813 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12814 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12815 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12816 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12817 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12818 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12820 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12821 | /* hp used DAC 3 (Front) */ |
| 12822 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12823 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12824 | |
| 12825 | { } |
| 12826 | }; |
| 12827 | |
| 12828 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 12829 | /* |
| 12830 | * Unmute ADC0 and set the default input to mic-in |
| 12831 | */ |
| 12832 | /* port-A for surround (rear panel) */ |
| 12833 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12834 | /* port-B for mic-in (rear panel) with vref */ |
| 12835 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12836 | /* port-C for line-in (rear panel) */ |
| 12837 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12838 | /* port-D for Front */ |
| 12839 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12840 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12841 | /* port-E for HP out (front panel) */ |
| 12842 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12843 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12844 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12845 | /* port-F for mic-in (front panel) with vref */ |
| 12846 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12847 | /* port-G for CLFE (rear panel) */ |
| 12848 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12849 | /* port-H for side (rear panel) */ |
| 12850 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12851 | /* CD-in */ |
| 12852 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12853 | /* route front mic to ADC1*/ |
| 12854 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12855 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12856 | /* Unmute DAC0~3 & spdif out*/ |
| 12857 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12858 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12859 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12860 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12861 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12862 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12863 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12864 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12865 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12866 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12867 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12868 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12869 | /* Unmute Stereo Mixer 15 */ |
| 12870 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12871 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12872 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12873 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12874 | |
| 12875 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12876 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12877 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12878 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12879 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12880 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12881 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12882 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12883 | /* hp used DAC 3 (Front) */ |
| 12884 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12885 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12886 | { } |
| 12887 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12888 | |
| 12889 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 12890 | /* |
| 12891 | * Unmute ADC0 and set the default input to mic-in |
| 12892 | */ |
| 12893 | /* port-A for surround (rear panel) */ |
| 12894 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12895 | /* port-B for mic-in (rear panel) with vref */ |
| 12896 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12897 | /* port-C for line-in (rear panel) */ |
| 12898 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12899 | /* port-D for Front */ |
| 12900 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12901 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12902 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12903 | /* this has to be set to VREF80 */ |
| 12904 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12905 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12906 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12907 | /* port-F for mic-in (front panel) with vref */ |
| 12908 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12909 | /* port-G for CLFE (rear panel) */ |
| 12910 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12911 | /* port-H for side (rear panel) */ |
| 12912 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12913 | /* CD-in */ |
| 12914 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12915 | /* route front mic to ADC1*/ |
| 12916 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12917 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12918 | /* Unmute DAC0~3 & spdif out*/ |
| 12919 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12920 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12921 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12922 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12923 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12924 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12925 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12926 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12927 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12928 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12929 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12930 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12931 | /* Unmute Stereo Mixer 15 */ |
| 12932 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12933 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12934 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12935 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12936 | |
| 12937 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12938 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12939 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12940 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12941 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12942 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12943 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12944 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12945 | /* hp used DAC 3 (Front) */ |
| 12946 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12947 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12948 | { } |
| 12949 | }; |
| 12950 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12951 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 12952 | /* |
| 12953 | * Unmute ADC0 and set the default input to mic-in |
| 12954 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12955 | /* port-A for surround (rear panel) |
| 12956 | * according to codec#0 this is the HP jack |
| 12957 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12958 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 12959 | /* route front PCM to HP */ |
| 12960 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12961 | /* port-B for mic-in (rear panel) with vref */ |
| 12962 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12963 | /* port-C for line-in (rear panel) */ |
| 12964 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12965 | /* port-D for Front */ |
| 12966 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12967 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12968 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12969 | /* this has to be set to VREF80 */ |
| 12970 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12971 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12972 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12973 | /* port-F for mic-in (front panel) with vref */ |
| 12974 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12975 | /* port-G for CLFE (rear panel) */ |
| 12976 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12977 | /* port-H for side (rear panel) */ |
| 12978 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12979 | /* CD-in */ |
| 12980 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12981 | /* route front mic to ADC1*/ |
| 12982 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12983 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12984 | /* Unmute DAC0~3 & spdif out*/ |
| 12985 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12986 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12987 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12988 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12989 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12990 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12991 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12992 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12993 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12994 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12995 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12996 | /* Unmute Stereo Mixer 15 */ |
| 12997 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12998 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12999 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13000 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13001 | |
| 13002 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13003 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13004 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13005 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13006 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13007 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13008 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13009 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13010 | /* hp used DAC 3 (Front) */ |
| 13011 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13012 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13013 | { } |
| 13014 | }; |
| 13015 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13016 | /* additional init verbs for ASUS laptops */ |
| 13017 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13018 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13019 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13020 | { } |
| 13021 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13022 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13023 | /* |
| 13024 | * generic initialization of ADC, input mixers and output mixers |
| 13025 | */ |
| 13026 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13027 | /* |
| 13028 | * Unmute ADC0 and set the default input to mic-in |
| 13029 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13030 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13031 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13032 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13033 | /* Unmute DAC0~3 & spdif out*/ |
| 13034 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13035 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13036 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13037 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13038 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13039 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13040 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13041 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13042 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13043 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13044 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13045 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13046 | /* Unmute Stereo Mixer 15 */ |
| 13047 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13048 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13049 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13050 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13051 | |
| 13052 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13053 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13054 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13055 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13056 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13057 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13058 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13059 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13060 | |
| 13061 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13062 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13063 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13064 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13065 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13066 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13067 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13068 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13069 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13070 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13071 | |
| 13072 | { } |
| 13073 | }; |
| 13074 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13075 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13076 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13077 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13078 | { } |
| 13079 | }; |
| 13080 | |
| 13081 | /* toggle speaker-output according to the hp-jack state */ |
| 13082 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13083 | { |
| 13084 | unsigned int present; |
| 13085 | |
| 13086 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13087 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13088 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13089 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13090 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13091 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13092 | } |
| 13093 | |
| 13094 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13095 | unsigned int res) |
| 13096 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13097 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13098 | alc861_toshiba_automute(codec); |
| 13099 | } |
| 13100 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13101 | /* pcm configuration: identiacal with ALC880 */ |
| 13102 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13103 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13104 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13105 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13106 | |
| 13107 | |
| 13108 | #define ALC861_DIGOUT_NID 0x07 |
| 13109 | |
| 13110 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13111 | { 8, NULL } |
| 13112 | }; |
| 13113 | |
| 13114 | static hda_nid_t alc861_dac_nids[4] = { |
| 13115 | /* front, surround, clfe, side */ |
| 13116 | 0x03, 0x06, 0x05, 0x04 |
| 13117 | }; |
| 13118 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13119 | static hda_nid_t alc660_dac_nids[3] = { |
| 13120 | /* front, clfe, surround */ |
| 13121 | 0x03, 0x05, 0x06 |
| 13122 | }; |
| 13123 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13124 | static hda_nid_t alc861_adc_nids[1] = { |
| 13125 | /* ADC0-2 */ |
| 13126 | 0x08, |
| 13127 | }; |
| 13128 | |
| 13129 | static struct hda_input_mux alc861_capture_source = { |
| 13130 | .num_items = 5, |
| 13131 | .items = { |
| 13132 | { "Mic", 0x0 }, |
| 13133 | { "Front Mic", 0x3 }, |
| 13134 | { "Line", 0x1 }, |
| 13135 | { "CD", 0x4 }, |
| 13136 | { "Mixer", 0x5 }, |
| 13137 | }, |
| 13138 | }; |
| 13139 | |
| 13140 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13141 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13142 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13143 | { |
| 13144 | int i; |
| 13145 | hda_nid_t nid; |
| 13146 | |
| 13147 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13148 | for (i = 0; i < cfg->line_outs; i++) { |
| 13149 | nid = cfg->line_out_pins[i]; |
| 13150 | if (nid) { |
| 13151 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13152 | continue; |
| 13153 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13154 | } |
| 13155 | } |
| 13156 | spec->multiout.num_dacs = cfg->line_outs; |
| 13157 | return 0; |
| 13158 | } |
| 13159 | |
| 13160 | /* add playback controls from the parsed DAC table */ |
| 13161 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13162 | const struct auto_pin_cfg *cfg) |
| 13163 | { |
| 13164 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13165 | static const char *chname[4] = { |
| 13166 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13167 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13168 | hda_nid_t nid; |
| 13169 | int i, idx, err; |
| 13170 | |
| 13171 | for (i = 0; i < cfg->line_outs; i++) { |
| 13172 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13173 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13174 | continue; |
| 13175 | if (nid == 0x05) { |
| 13176 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13177 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13178 | "Center Playback Switch", |
| 13179 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13180 | HDA_OUTPUT)); |
| 13181 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13182 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13183 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13184 | "LFE Playback Switch", |
| 13185 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13186 | HDA_OUTPUT)); |
| 13187 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13188 | return err; |
| 13189 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13190 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13191 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13192 | if (nid == alc861_dac_nids[idx]) |
| 13193 | break; |
| 13194 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13195 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13196 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13197 | HDA_OUTPUT)); |
| 13198 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13199 | return err; |
| 13200 | } |
| 13201 | } |
| 13202 | return 0; |
| 13203 | } |
| 13204 | |
| 13205 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13206 | { |
| 13207 | int err; |
| 13208 | hda_nid_t nid; |
| 13209 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13210 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13211 | return 0; |
| 13212 | |
| 13213 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13214 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13215 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13216 | "Headphone Playback Switch", |
| 13217 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13218 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13219 | return err; |
| 13220 | spec->multiout.hp_nid = nid; |
| 13221 | } |
| 13222 | return 0; |
| 13223 | } |
| 13224 | |
| 13225 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13226 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13227 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13228 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13229 | struct hda_input_mux *imux = &spec->private_imux; |
| 13230 | int i, err, idx, idx1; |
| 13231 | |
| 13232 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13233 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13234 | case 0x0c: |
| 13235 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13236 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13237 | break; |
| 13238 | case 0x0f: |
| 13239 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13240 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13241 | break; |
| 13242 | case 0x0d: |
| 13243 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13244 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13245 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13246 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13247 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13248 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13249 | break; |
| 13250 | case 0x11: |
| 13251 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13252 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13253 | break; |
| 13254 | default: |
| 13255 | continue; |
| 13256 | } |
| 13257 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13258 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13259 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13260 | if (err < 0) |
| 13261 | return err; |
| 13262 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13263 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13264 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13265 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13266 | } |
| 13267 | return 0; |
| 13268 | } |
| 13269 | |
| 13270 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 13271 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13272 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13273 | |
| 13274 | { |
| 13275 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13276 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13277 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13278 | */ |
| 13279 | /* .name = "Capture Source", */ |
| 13280 | .name = "Input Source", |
| 13281 | .count = 1, |
| 13282 | .info = alc_mux_enum_info, |
| 13283 | .get = alc_mux_enum_get, |
| 13284 | .put = alc_mux_enum_put, |
| 13285 | }, |
| 13286 | { } /* end */ |
| 13287 | }; |
| 13288 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13289 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13290 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13291 | int pin_type, int dac_idx) |
| 13292 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13293 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13294 | pin_type); |
| 13295 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13296 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13297 | } |
| 13298 | |
| 13299 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13300 | { |
| 13301 | struct alc_spec *spec = codec->spec; |
| 13302 | int i; |
| 13303 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13304 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13305 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13306 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13307 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13308 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13309 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13310 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13311 | } |
| 13312 | } |
| 13313 | |
| 13314 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13315 | { |
| 13316 | struct alc_spec *spec = codec->spec; |
| 13317 | hda_nid_t pin; |
| 13318 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13319 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13320 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13321 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13322 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13323 | pin = spec->autocfg.speaker_pins[0]; |
| 13324 | if (pin) |
| 13325 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13326 | } |
| 13327 | |
| 13328 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13329 | { |
| 13330 | struct alc_spec *spec = codec->spec; |
| 13331 | int i; |
| 13332 | |
| 13333 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13334 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13335 | if (nid >= 0x0c && nid <= 0x11) { |
| 13336 | snd_hda_codec_write(codec, nid, 0, |
| 13337 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13338 | i <= AUTO_PIN_FRONT_MIC ? |
| 13339 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13340 | } |
| 13341 | } |
| 13342 | } |
| 13343 | |
| 13344 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13345 | /* return 1 if successful, 0 if the proper config is not found, |
| 13346 | * or a negative error code |
| 13347 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13348 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13349 | { |
| 13350 | struct alc_spec *spec = codec->spec; |
| 13351 | int err; |
| 13352 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13353 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13354 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13355 | alc861_ignore); |
| 13356 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13357 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13358 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13359 | return 0; /* can't find valid BIOS pin config */ |
| 13360 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13361 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13362 | if (err < 0) |
| 13363 | return err; |
| 13364 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13365 | if (err < 0) |
| 13366 | return err; |
| 13367 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13368 | if (err < 0) |
| 13369 | return err; |
| 13370 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13371 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13372 | return err; |
| 13373 | |
| 13374 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13375 | |
| 13376 | if (spec->autocfg.dig_out_pin) |
| 13377 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13378 | |
| 13379 | if (spec->kctl_alloc) |
| 13380 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13381 | |
| 13382 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 13383 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13384 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13385 | spec->input_mux = &spec->private_imux; |
| 13386 | |
| 13387 | spec->adc_nids = alc861_adc_nids; |
| 13388 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 13389 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 13390 | spec->num_mixers++; |
| 13391 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame^] | 13392 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13393 | return 1; |
| 13394 | } |
| 13395 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13396 | /* additional initialization for auto-configuration model */ |
| 13397 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13398 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13399 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13400 | alc861_auto_init_multi_out(codec); |
| 13401 | alc861_auto_init_hp_out(codec); |
| 13402 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13403 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13404 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13405 | } |
| 13406 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13407 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13408 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13409 | { 0x15, HDA_INPUT, 0 }, |
| 13410 | { 0x15, HDA_INPUT, 1 }, |
| 13411 | { 0x15, HDA_INPUT, 2 }, |
| 13412 | { 0x15, HDA_INPUT, 3 }, |
| 13413 | { } /* end */ |
| 13414 | }; |
| 13415 | #endif |
| 13416 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13417 | |
| 13418 | /* |
| 13419 | * configuration and preset |
| 13420 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13421 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13422 | [ALC861_3ST] = "3stack", |
| 13423 | [ALC660_3ST] = "3stack-660", |
| 13424 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13425 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13426 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 13427 | [ALC861_TOSHIBA] = "toshiba", |
| 13428 | [ALC861_ASUS] = "asus", |
| 13429 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 13430 | [ALC861_AUTO] = "auto", |
| 13431 | }; |
| 13432 | |
| 13433 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 13434 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13435 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13436 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13437 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13438 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 13439 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 13440 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 13441 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 13442 | * Any other models that need this preset? |
| 13443 | */ |
| 13444 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 13445 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 13446 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13447 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 13448 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 13449 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 13450 | /* FIXME: the below seems conflict */ |
| 13451 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 13452 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 13453 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13454 | {} |
| 13455 | }; |
| 13456 | |
| 13457 | static struct alc_config_preset alc861_presets[] = { |
| 13458 | [ALC861_3ST] = { |
| 13459 | .mixers = { alc861_3ST_mixer }, |
| 13460 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13461 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13462 | .dac_nids = alc861_dac_nids, |
| 13463 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13464 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13465 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13466 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13467 | .adc_nids = alc861_adc_nids, |
| 13468 | .input_mux = &alc861_capture_source, |
| 13469 | }, |
| 13470 | [ALC861_3ST_DIG] = { |
| 13471 | .mixers = { alc861_base_mixer }, |
| 13472 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13473 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13474 | .dac_nids = alc861_dac_nids, |
| 13475 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13476 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13477 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13478 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13479 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13480 | .adc_nids = alc861_adc_nids, |
| 13481 | .input_mux = &alc861_capture_source, |
| 13482 | }, |
| 13483 | [ALC861_6ST_DIG] = { |
| 13484 | .mixers = { alc861_base_mixer }, |
| 13485 | .init_verbs = { alc861_base_init_verbs }, |
| 13486 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13487 | .dac_nids = alc861_dac_nids, |
| 13488 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13489 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 13490 | .channel_mode = alc861_8ch_modes, |
| 13491 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13492 | .adc_nids = alc861_adc_nids, |
| 13493 | .input_mux = &alc861_capture_source, |
| 13494 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13495 | [ALC660_3ST] = { |
| 13496 | .mixers = { alc861_3ST_mixer }, |
| 13497 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13498 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 13499 | .dac_nids = alc660_dac_nids, |
| 13500 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13501 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13502 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13503 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13504 | .adc_nids = alc861_adc_nids, |
| 13505 | .input_mux = &alc861_capture_source, |
| 13506 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13507 | [ALC861_UNIWILL_M31] = { |
| 13508 | .mixers = { alc861_uniwill_m31_mixer }, |
| 13509 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 13510 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13511 | .dac_nids = alc861_dac_nids, |
| 13512 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13513 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13514 | .channel_mode = alc861_uniwill_m31_modes, |
| 13515 | .need_dac_fix = 1, |
| 13516 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13517 | .adc_nids = alc861_adc_nids, |
| 13518 | .input_mux = &alc861_capture_source, |
| 13519 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13520 | [ALC861_TOSHIBA] = { |
| 13521 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13522 | .init_verbs = { alc861_base_init_verbs, |
| 13523 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13524 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13525 | .dac_nids = alc861_dac_nids, |
| 13526 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13527 | .channel_mode = alc883_3ST_2ch_modes, |
| 13528 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13529 | .adc_nids = alc861_adc_nids, |
| 13530 | .input_mux = &alc861_capture_source, |
| 13531 | .unsol_event = alc861_toshiba_unsol_event, |
| 13532 | .init_hook = alc861_toshiba_automute, |
| 13533 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13534 | [ALC861_ASUS] = { |
| 13535 | .mixers = { alc861_asus_mixer }, |
| 13536 | .init_verbs = { alc861_asus_init_verbs }, |
| 13537 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13538 | .dac_nids = alc861_dac_nids, |
| 13539 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13540 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 13541 | .channel_mode = alc861_asus_modes, |
| 13542 | .need_dac_fix = 1, |
| 13543 | .hp_nid = 0x06, |
| 13544 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13545 | .adc_nids = alc861_adc_nids, |
| 13546 | .input_mux = &alc861_capture_source, |
| 13547 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13548 | [ALC861_ASUS_LAPTOP] = { |
| 13549 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 13550 | .init_verbs = { alc861_asus_init_verbs, |
| 13551 | alc861_asus_laptop_init_verbs }, |
| 13552 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13553 | .dac_nids = alc861_dac_nids, |
| 13554 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13555 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13556 | .channel_mode = alc883_3ST_2ch_modes, |
| 13557 | .need_dac_fix = 1, |
| 13558 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13559 | .adc_nids = alc861_adc_nids, |
| 13560 | .input_mux = &alc861_capture_source, |
| 13561 | }, |
| 13562 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13563 | |
| 13564 | |
| 13565 | static int patch_alc861(struct hda_codec *codec) |
| 13566 | { |
| 13567 | struct alc_spec *spec; |
| 13568 | int board_config; |
| 13569 | int err; |
| 13570 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 13571 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13572 | if (spec == NULL) |
| 13573 | return -ENOMEM; |
| 13574 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13575 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13576 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13577 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 13578 | alc861_models, |
| 13579 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13580 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13581 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13582 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 13583 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13584 | board_config = ALC861_AUTO; |
| 13585 | } |
| 13586 | |
| 13587 | if (board_config == ALC861_AUTO) { |
| 13588 | /* automatic parse from the BIOS config */ |
| 13589 | err = alc861_parse_auto_config(codec); |
| 13590 | if (err < 0) { |
| 13591 | alc_free(codec); |
| 13592 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13593 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13594 | printk(KERN_INFO |
| 13595 | "hda_codec: Cannot set up configuration " |
| 13596 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13597 | board_config = ALC861_3ST_DIG; |
| 13598 | } |
| 13599 | } |
| 13600 | |
| 13601 | if (board_config != ALC861_AUTO) |
| 13602 | setup_preset(spec, &alc861_presets[board_config]); |
| 13603 | |
| 13604 | spec->stream_name_analog = "ALC861 Analog"; |
| 13605 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 13606 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 13607 | |
| 13608 | spec->stream_name_digital = "ALC861 Digital"; |
| 13609 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 13610 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 13611 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13612 | spec->vmaster_nid = 0x03; |
| 13613 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13614 | codec->patch_ops = alc_patch_ops; |
| 13615 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13616 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13617 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13618 | if (!spec->loopback.amplist) |
| 13619 | spec->loopback.amplist = alc861_loopbacks; |
| 13620 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13621 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13622 | return 0; |
| 13623 | } |
| 13624 | |
| 13625 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13626 | * ALC861-VD support |
| 13627 | * |
| 13628 | * Based on ALC882 |
| 13629 | * |
| 13630 | * In addition, an independent DAC |
| 13631 | */ |
| 13632 | #define ALC861VD_DIGOUT_NID 0x06 |
| 13633 | |
| 13634 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 13635 | /* front, surr, clfe, side surr */ |
| 13636 | 0x02, 0x03, 0x04, 0x05 |
| 13637 | }; |
| 13638 | |
| 13639 | /* dac_nids for ALC660vd are in a different order - according to |
| 13640 | * Realtek's driver. |
| 13641 | * This should probably tesult in a different mixer for 6stack models |
| 13642 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 13643 | * - and it is the same as in 861vd. |
| 13644 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 13645 | */ |
| 13646 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 13647 | /* front, rear, clfe, rear_surr */ |
| 13648 | 0x02, 0x04, 0x03 |
| 13649 | }; |
| 13650 | |
| 13651 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 13652 | /* ADC0 */ |
| 13653 | 0x09, |
| 13654 | }; |
| 13655 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13656 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 13657 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13658 | /* input MUX */ |
| 13659 | /* FIXME: should be a matrix-type input source selection */ |
| 13660 | static struct hda_input_mux alc861vd_capture_source = { |
| 13661 | .num_items = 4, |
| 13662 | .items = { |
| 13663 | { "Mic", 0x0 }, |
| 13664 | { "Front Mic", 0x1 }, |
| 13665 | { "Line", 0x2 }, |
| 13666 | { "CD", 0x4 }, |
| 13667 | }, |
| 13668 | }; |
| 13669 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13670 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13671 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13672 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13673 | { "Ext Mic", 0x0 }, |
| 13674 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13675 | }, |
| 13676 | }; |
| 13677 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13678 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 13679 | .num_items = 2, |
| 13680 | .items = { |
| 13681 | { "Front Mic", 0x0 }, |
| 13682 | { "ATAPI Mic", 0x1 }, |
| 13683 | }, |
| 13684 | }; |
| 13685 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13686 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 13687 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13688 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 13689 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13690 | |
| 13691 | /* |
| 13692 | * 2ch mode |
| 13693 | */ |
| 13694 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 13695 | { 2, NULL } |
| 13696 | }; |
| 13697 | |
| 13698 | /* |
| 13699 | * 6ch mode |
| 13700 | */ |
| 13701 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 13702 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13703 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13704 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13705 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13706 | { } /* end */ |
| 13707 | }; |
| 13708 | |
| 13709 | /* |
| 13710 | * 8ch mode |
| 13711 | */ |
| 13712 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 13713 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13714 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13715 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13716 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13717 | { } /* end */ |
| 13718 | }; |
| 13719 | |
| 13720 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 13721 | { 6, alc861vd_6stack_ch6_init }, |
| 13722 | { 8, alc861vd_6stack_ch8_init }, |
| 13723 | }; |
| 13724 | |
| 13725 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 13726 | { |
| 13727 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13728 | .name = "Channel Mode", |
| 13729 | .info = alc_ch_mode_info, |
| 13730 | .get = alc_ch_mode_get, |
| 13731 | .put = alc_ch_mode_put, |
| 13732 | }, |
| 13733 | { } /* end */ |
| 13734 | }; |
| 13735 | |
| 13736 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 13737 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13738 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13739 | |
| 13740 | { |
| 13741 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13742 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13743 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13744 | */ |
| 13745 | /* .name = "Capture Source", */ |
| 13746 | .name = "Input Source", |
| 13747 | .count = 1, |
| 13748 | .info = alc861vd_mux_enum_info, |
| 13749 | .get = alc861vd_mux_enum_get, |
| 13750 | .put = alc861vd_mux_enum_put, |
| 13751 | }, |
| 13752 | { } /* end */ |
| 13753 | }; |
| 13754 | |
| 13755 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13756 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13757 | */ |
| 13758 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 13759 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13760 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13761 | |
| 13762 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13763 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13764 | |
| 13765 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 13766 | HDA_OUTPUT), |
| 13767 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 13768 | HDA_OUTPUT), |
| 13769 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13770 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 13771 | |
| 13772 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 13773 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13774 | |
| 13775 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13776 | |
| 13777 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13778 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13779 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13780 | |
| 13781 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13782 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13783 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13784 | |
| 13785 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13786 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13787 | |
| 13788 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13789 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13790 | |
| 13791 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13792 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13793 | |
| 13794 | { } /* end */ |
| 13795 | }; |
| 13796 | |
| 13797 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 13798 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13799 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13800 | |
| 13801 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13802 | |
| 13803 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13804 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13805 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13806 | |
| 13807 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13808 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13809 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13810 | |
| 13811 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13812 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13813 | |
| 13814 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13815 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13816 | |
| 13817 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13818 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13819 | |
| 13820 | { } /* end */ |
| 13821 | }; |
| 13822 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13823 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 13824 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13825 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 13826 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13827 | |
| 13828 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13829 | |
| 13830 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13831 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13832 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13833 | |
| 13834 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13835 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13836 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13837 | |
| 13838 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13839 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13840 | |
| 13841 | { } /* end */ |
| 13842 | }; |
| 13843 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13844 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 13845 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13846 | */ |
| 13847 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13848 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13849 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13850 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13851 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13852 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13853 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13854 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13855 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13856 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13857 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13858 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 13859 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13860 | { } /* end */ |
| 13861 | }; |
| 13862 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13863 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 13864 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 13865 | */ |
| 13866 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 13867 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13868 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13869 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13870 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13871 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13872 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13873 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13874 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13875 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13876 | { } /* end */ |
| 13877 | }; |
| 13878 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13879 | /* |
| 13880 | * generic initialization of ADC, input mixers and output mixers |
| 13881 | */ |
| 13882 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 13883 | /* |
| 13884 | * Unmute ADC0 and set the default input to mic-in |
| 13885 | */ |
| 13886 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13887 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13888 | |
| 13889 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 13890 | * the analog-loopback mixer widget |
| 13891 | */ |
| 13892 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13893 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13894 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13895 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13896 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13897 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13898 | |
| 13899 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13900 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13901 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13902 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13903 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13904 | |
| 13905 | /* |
| 13906 | * Set up output mixers (0x02 - 0x05) |
| 13907 | */ |
| 13908 | /* set vol=0 to output mixers */ |
| 13909 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13910 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13911 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13912 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13913 | |
| 13914 | /* set up input amps for analog loopback */ |
| 13915 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13916 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13917 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13918 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13919 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13920 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13921 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13922 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13923 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13924 | |
| 13925 | { } |
| 13926 | }; |
| 13927 | |
| 13928 | /* |
| 13929 | * 3-stack pin configuration: |
| 13930 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 13931 | */ |
| 13932 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 13933 | /* |
| 13934 | * Set pin mode and muting |
| 13935 | */ |
| 13936 | /* set front pin widgets 0x14 for output */ |
| 13937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13938 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13939 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13940 | |
| 13941 | /* Mic (rear) pin: input vref at 80% */ |
| 13942 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13943 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13944 | /* Front Mic pin: input vref at 80% */ |
| 13945 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13946 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13947 | /* Line In pin: input */ |
| 13948 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13949 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13950 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13951 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13952 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13953 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13954 | /* CD pin widget for input */ |
| 13955 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13956 | |
| 13957 | { } |
| 13958 | }; |
| 13959 | |
| 13960 | /* |
| 13961 | * 6-stack pin configuration: |
| 13962 | */ |
| 13963 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 13964 | /* |
| 13965 | * Set pin mode and muting |
| 13966 | */ |
| 13967 | /* set front pin widgets 0x14 for output */ |
| 13968 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13969 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13970 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13971 | |
| 13972 | /* Rear Pin: output 1 (0x0d) */ |
| 13973 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13974 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13975 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13976 | /* CLFE Pin: output 2 (0x0e) */ |
| 13977 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13978 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13979 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 13980 | /* Side Pin: output 3 (0x0f) */ |
| 13981 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13982 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13983 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 13984 | |
| 13985 | /* Mic (rear) pin: input vref at 80% */ |
| 13986 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13987 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13988 | /* Front Mic pin: input vref at 80% */ |
| 13989 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13990 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13991 | /* Line In pin: input */ |
| 13992 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13993 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13994 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13995 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13996 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13997 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13998 | /* CD pin widget for input */ |
| 13999 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14000 | |
| 14001 | { } |
| 14002 | }; |
| 14003 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14004 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14005 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14006 | { } |
| 14007 | }; |
| 14008 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14009 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14010 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14011 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14012 | { } |
| 14013 | }; |
| 14014 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14015 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14016 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14017 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14018 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14019 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14020 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14021 | {} |
| 14022 | }; |
| 14023 | |
| 14024 | /* toggle speaker-output according to the hp-jack state */ |
| 14025 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 14026 | { |
| 14027 | unsigned int present; |
| 14028 | unsigned char bits; |
| 14029 | |
| 14030 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14031 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14032 | bits = present ? HDA_AMP_MUTE : 0; |
| 14033 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14034 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14035 | } |
| 14036 | |
| 14037 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14038 | { |
| 14039 | unsigned int present; |
| 14040 | unsigned char bits; |
| 14041 | |
| 14042 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14043 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14044 | bits = present ? HDA_AMP_MUTE : 0; |
| 14045 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14046 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14047 | } |
| 14048 | |
| 14049 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 14050 | { |
| 14051 | alc861vd_lenovo_hp_automute(codec); |
| 14052 | alc861vd_lenovo_mic_automute(codec); |
| 14053 | } |
| 14054 | |
| 14055 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14056 | unsigned int res) |
| 14057 | { |
| 14058 | switch (res >> 26) { |
| 14059 | case ALC880_HP_EVENT: |
| 14060 | alc861vd_lenovo_hp_automute(codec); |
| 14061 | break; |
| 14062 | case ALC880_MIC_EVENT: |
| 14063 | alc861vd_lenovo_mic_automute(codec); |
| 14064 | break; |
| 14065 | } |
| 14066 | } |
| 14067 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14068 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14069 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14070 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14071 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14072 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14073 | |
| 14074 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14075 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14076 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14077 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14078 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14079 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14080 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14081 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14082 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14083 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14084 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14085 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14086 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14087 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14088 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14089 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14090 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14091 | |
| 14092 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14093 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14094 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14095 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14096 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14097 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14098 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14099 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14100 | |
| 14101 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14102 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14103 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14104 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14105 | |
| 14106 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14107 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14108 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14109 | |
| 14110 | { } /* end */ |
| 14111 | }; |
| 14112 | |
| 14113 | /* toggle speaker-output according to the hp-jack state */ |
| 14114 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 14115 | { |
| 14116 | unsigned int present; |
| 14117 | |
| 14118 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14119 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14120 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14121 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14122 | } |
| 14123 | |
| 14124 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 14125 | { |
| 14126 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14127 | alc861vd_dallas_automute(codec); |
| 14128 | } |
| 14129 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14130 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14131 | #define alc861vd_loopbacks alc880_loopbacks |
| 14132 | #endif |
| 14133 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14134 | /* pcm configuration: identiacal with ALC880 */ |
| 14135 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14136 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14137 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14138 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14139 | |
| 14140 | /* |
| 14141 | * configuration and preset |
| 14142 | */ |
| 14143 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14144 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14145 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14146 | [ALC861VD_3ST] = "3stack", |
| 14147 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14148 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14149 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14150 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14151 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14152 | [ALC861VD_AUTO] = "auto", |
| 14153 | }; |
| 14154 | |
| 14155 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14156 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14157 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14158 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14159 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Alexander Holler | 2522d73 | 2008-07-17 23:36:15 +0200 | [diff] [blame] | 14160 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14161 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14162 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14163 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14164 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14165 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14166 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14167 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14168 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14169 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 14170 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Takashi Iwai | be321a89 | 2008-07-07 16:04:04 +0200 | [diff] [blame] | 14171 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14172 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14173 | {} |
| 14174 | }; |
| 14175 | |
| 14176 | static struct alc_config_preset alc861vd_presets[] = { |
| 14177 | [ALC660VD_3ST] = { |
| 14178 | .mixers = { alc861vd_3st_mixer }, |
| 14179 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14180 | alc861vd_3stack_init_verbs }, |
| 14181 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14182 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14183 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14184 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14185 | .input_mux = &alc861vd_capture_source, |
| 14186 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14187 | [ALC660VD_3ST_DIG] = { |
| 14188 | .mixers = { alc861vd_3st_mixer }, |
| 14189 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14190 | alc861vd_3stack_init_verbs }, |
| 14191 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14192 | .dac_nids = alc660vd_dac_nids, |
| 14193 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14194 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14195 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14196 | .input_mux = &alc861vd_capture_source, |
| 14197 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14198 | [ALC861VD_3ST] = { |
| 14199 | .mixers = { alc861vd_3st_mixer }, |
| 14200 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14201 | alc861vd_3stack_init_verbs }, |
| 14202 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14203 | .dac_nids = alc861vd_dac_nids, |
| 14204 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14205 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14206 | .input_mux = &alc861vd_capture_source, |
| 14207 | }, |
| 14208 | [ALC861VD_3ST_DIG] = { |
| 14209 | .mixers = { alc861vd_3st_mixer }, |
| 14210 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14211 | alc861vd_3stack_init_verbs }, |
| 14212 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14213 | .dac_nids = alc861vd_dac_nids, |
| 14214 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14215 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14216 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14217 | .input_mux = &alc861vd_capture_source, |
| 14218 | }, |
| 14219 | [ALC861VD_6ST_DIG] = { |
| 14220 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14221 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14222 | alc861vd_6stack_init_verbs }, |
| 14223 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14224 | .dac_nids = alc861vd_dac_nids, |
| 14225 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14226 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14227 | .channel_mode = alc861vd_6stack_modes, |
| 14228 | .input_mux = &alc861vd_capture_source, |
| 14229 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14230 | [ALC861VD_LENOVO] = { |
| 14231 | .mixers = { alc861vd_lenovo_mixer }, |
| 14232 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14233 | alc861vd_3stack_init_verbs, |
| 14234 | alc861vd_eapd_verbs, |
| 14235 | alc861vd_lenovo_unsol_verbs }, |
| 14236 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14237 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14238 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14239 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14240 | .input_mux = &alc861vd_capture_source, |
| 14241 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14242 | .init_hook = alc861vd_lenovo_automute, |
| 14243 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14244 | [ALC861VD_DALLAS] = { |
| 14245 | .mixers = { alc861vd_dallas_mixer }, |
| 14246 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14247 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14248 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14249 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14250 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14251 | .input_mux = &alc861vd_dallas_capture_source, |
| 14252 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14253 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14254 | }, |
| 14255 | [ALC861VD_HP] = { |
| 14256 | .mixers = { alc861vd_hp_mixer }, |
| 14257 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14258 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14259 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14260 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14261 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14262 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14263 | .input_mux = &alc861vd_hp_capture_source, |
| 14264 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14265 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14266 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14267 | }; |
| 14268 | |
| 14269 | /* |
| 14270 | * BIOS auto configuration |
| 14271 | */ |
| 14272 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14273 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14274 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14275 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14276 | } |
| 14277 | |
| 14278 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14279 | { |
| 14280 | struct alc_spec *spec = codec->spec; |
| 14281 | int i; |
| 14282 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14283 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14284 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14285 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14286 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14287 | if (nid) |
| 14288 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14289 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14290 | } |
| 14291 | } |
| 14292 | |
| 14293 | |
| 14294 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14295 | { |
| 14296 | struct alc_spec *spec = codec->spec; |
| 14297 | hda_nid_t pin; |
| 14298 | |
| 14299 | pin = spec->autocfg.hp_pins[0]; |
| 14300 | if (pin) /* connect to front and use dac 0 */ |
| 14301 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14302 | pin = spec->autocfg.speaker_pins[0]; |
| 14303 | if (pin) |
| 14304 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14305 | } |
| 14306 | |
| 14307 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14308 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14309 | |
| 14310 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14311 | { |
| 14312 | struct alc_spec *spec = codec->spec; |
| 14313 | int i; |
| 14314 | |
| 14315 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14316 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14317 | if (alc861vd_is_input_pin(nid)) { |
| 14318 | snd_hda_codec_write(codec, nid, 0, |
| 14319 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14320 | i <= AUTO_PIN_FRONT_MIC ? |
| 14321 | PIN_VREF80 : PIN_IN); |
| 14322 | if (nid != ALC861VD_PIN_CD_NID) |
| 14323 | snd_hda_codec_write(codec, nid, 0, |
| 14324 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14325 | AMP_OUT_MUTE); |
| 14326 | } |
| 14327 | } |
| 14328 | } |
| 14329 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14330 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14331 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14332 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14333 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14334 | |
| 14335 | /* add playback controls from the parsed DAC table */ |
| 14336 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14337 | * different NIDs for mute/unmute switch and volume control */ |
| 14338 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14339 | const struct auto_pin_cfg *cfg) |
| 14340 | { |
| 14341 | char name[32]; |
| 14342 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14343 | hda_nid_t nid_v, nid_s; |
| 14344 | int i, err; |
| 14345 | |
| 14346 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14347 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14348 | continue; |
| 14349 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14350 | alc880_dac_to_idx( |
| 14351 | spec->multiout.dac_nids[i])); |
| 14352 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14353 | alc880_dac_to_idx( |
| 14354 | spec->multiout.dac_nids[i])); |
| 14355 | |
| 14356 | if (i == 2) { |
| 14357 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14358 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14359 | "Center Playback Volume", |
| 14360 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14361 | HDA_OUTPUT)); |
| 14362 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14363 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14364 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14365 | "LFE Playback Volume", |
| 14366 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14367 | HDA_OUTPUT)); |
| 14368 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14369 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14370 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14371 | "Center Playback Switch", |
| 14372 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14373 | HDA_INPUT)); |
| 14374 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14375 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14376 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14377 | "LFE Playback Switch", |
| 14378 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14379 | HDA_INPUT)); |
| 14380 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14381 | return err; |
| 14382 | } else { |
| 14383 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14384 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14385 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14386 | HDA_OUTPUT)); |
| 14387 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14388 | return err; |
| 14389 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14390 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14391 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14392 | HDA_INPUT)); |
| 14393 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14394 | return err; |
| 14395 | } |
| 14396 | } |
| 14397 | return 0; |
| 14398 | } |
| 14399 | |
| 14400 | /* add playback controls for speaker and HP outputs */ |
| 14401 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14402 | * different NIDs for mute/unmute switch and volume control */ |
| 14403 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14404 | hda_nid_t pin, const char *pfx) |
| 14405 | { |
| 14406 | hda_nid_t nid_v, nid_s; |
| 14407 | int err; |
| 14408 | char name[32]; |
| 14409 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14410 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14411 | return 0; |
| 14412 | |
| 14413 | if (alc880_is_fixed_pin(pin)) { |
| 14414 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14415 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14416 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14417 | spec->multiout.hp_nid = nid_v; |
| 14418 | else |
| 14419 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14420 | /* control HP volume/switch on the output mixer amp */ |
| 14421 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14422 | alc880_fixed_pin_idx(pin)); |
| 14423 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14424 | alc880_fixed_pin_idx(pin)); |
| 14425 | |
| 14426 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14427 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14428 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14429 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14430 | return err; |
| 14431 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14432 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14433 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14434 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14435 | return err; |
| 14436 | } else if (alc880_is_multi_pin(pin)) { |
| 14437 | /* set manual connection */ |
| 14438 | /* we have only a switch on HP-out PIN */ |
| 14439 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14440 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14441 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14442 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14443 | return err; |
| 14444 | } |
| 14445 | return 0; |
| 14446 | } |
| 14447 | |
| 14448 | /* parse the BIOS configuration and set up the alc_spec |
| 14449 | * return 1 if successful, 0 if the proper config is not found, |
| 14450 | * or a negative error code |
| 14451 | * Based on ALC880 version - had to change it to override |
| 14452 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 14453 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 14454 | { |
| 14455 | struct alc_spec *spec = codec->spec; |
| 14456 | int err; |
| 14457 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 14458 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14459 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14460 | alc861vd_ignore); |
| 14461 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14462 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14463 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14464 | return 0; /* can't find valid BIOS pin config */ |
| 14465 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14466 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14467 | if (err < 0) |
| 14468 | return err; |
| 14469 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14470 | if (err < 0) |
| 14471 | return err; |
| 14472 | err = alc861vd_auto_create_extra_out(spec, |
| 14473 | spec->autocfg.speaker_pins[0], |
| 14474 | "Speaker"); |
| 14475 | if (err < 0) |
| 14476 | return err; |
| 14477 | err = alc861vd_auto_create_extra_out(spec, |
| 14478 | spec->autocfg.hp_pins[0], |
| 14479 | "Headphone"); |
| 14480 | if (err < 0) |
| 14481 | return err; |
| 14482 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14483 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14484 | return err; |
| 14485 | |
| 14486 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14487 | |
| 14488 | if (spec->autocfg.dig_out_pin) |
| 14489 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 14490 | |
| 14491 | if (spec->kctl_alloc) |
| 14492 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 14493 | |
| 14494 | spec->init_verbs[spec->num_init_verbs++] |
| 14495 | = alc861vd_volume_init_verbs; |
| 14496 | |
| 14497 | spec->num_mux_defs = 1; |
| 14498 | spec->input_mux = &spec->private_imux; |
| 14499 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 14500 | err = alc_auto_add_mic_boost(codec); |
| 14501 | if (err < 0) |
| 14502 | return err; |
| 14503 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame^] | 14504 | store_pin_configs(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14505 | return 1; |
| 14506 | } |
| 14507 | |
| 14508 | /* additional initialization for auto-configuration model */ |
| 14509 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 14510 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14511 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14512 | alc861vd_auto_init_multi_out(codec); |
| 14513 | alc861vd_auto_init_hp_out(codec); |
| 14514 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14515 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14516 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14517 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14518 | } |
| 14519 | |
| 14520 | static int patch_alc861vd(struct hda_codec *codec) |
| 14521 | { |
| 14522 | struct alc_spec *spec; |
| 14523 | int err, board_config; |
| 14524 | |
| 14525 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14526 | if (spec == NULL) |
| 14527 | return -ENOMEM; |
| 14528 | |
| 14529 | codec->spec = spec; |
| 14530 | |
| 14531 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 14532 | alc861vd_models, |
| 14533 | alc861vd_cfg_tbl); |
| 14534 | |
| 14535 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 14536 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 14537 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 14538 | board_config = ALC861VD_AUTO; |
| 14539 | } |
| 14540 | |
| 14541 | if (board_config == ALC861VD_AUTO) { |
| 14542 | /* automatic parse from the BIOS config */ |
| 14543 | err = alc861vd_parse_auto_config(codec); |
| 14544 | if (err < 0) { |
| 14545 | alc_free(codec); |
| 14546 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14547 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14548 | printk(KERN_INFO |
| 14549 | "hda_codec: Cannot set up configuration " |
| 14550 | "from BIOS. Using base mode...\n"); |
| 14551 | board_config = ALC861VD_3ST; |
| 14552 | } |
| 14553 | } |
| 14554 | |
| 14555 | if (board_config != ALC861VD_AUTO) |
| 14556 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 14557 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14558 | if (codec->vendor_id == 0x10ec0660) { |
| 14559 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 14560 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14561 | /* always turn on EAPD */ |
| 14562 | spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14563 | } else { |
| 14564 | spec->stream_name_analog = "ALC861VD Analog"; |
| 14565 | spec->stream_name_digital = "ALC861VD Digital"; |
| 14566 | } |
| 14567 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14568 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 14569 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 14570 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14571 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 14572 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 14573 | |
| 14574 | spec->adc_nids = alc861vd_adc_nids; |
| 14575 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14576 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14577 | |
| 14578 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 14579 | spec->num_mixers++; |
| 14580 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14581 | spec->vmaster_nid = 0x02; |
| 14582 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14583 | codec->patch_ops = alc_patch_ops; |
| 14584 | |
| 14585 | if (board_config == ALC861VD_AUTO) |
| 14586 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14587 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14588 | if (!spec->loopback.amplist) |
| 14589 | spec->loopback.amplist = alc861vd_loopbacks; |
| 14590 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14591 | |
| 14592 | return 0; |
| 14593 | } |
| 14594 | |
| 14595 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14596 | * ALC662 support |
| 14597 | * |
| 14598 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 14599 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 14600 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 14601 | * 6-channel independent captures. |
| 14602 | * |
| 14603 | * In addition, an independent DAC for the multi-playback (not used in this |
| 14604 | * driver yet). |
| 14605 | */ |
| 14606 | #define ALC662_DIGOUT_NID 0x06 |
| 14607 | #define ALC662_DIGIN_NID 0x0a |
| 14608 | |
| 14609 | static hda_nid_t alc662_dac_nids[4] = { |
| 14610 | /* front, rear, clfe, rear_surr */ |
| 14611 | 0x02, 0x03, 0x04 |
| 14612 | }; |
| 14613 | |
| 14614 | static hda_nid_t alc662_adc_nids[1] = { |
| 14615 | /* ADC1-2 */ |
| 14616 | 0x09, |
| 14617 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14618 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 14619 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14620 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14621 | /* input MUX */ |
| 14622 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14623 | static struct hda_input_mux alc662_capture_source = { |
| 14624 | .num_items = 4, |
| 14625 | .items = { |
| 14626 | { "Mic", 0x0 }, |
| 14627 | { "Front Mic", 0x1 }, |
| 14628 | { "Line", 0x2 }, |
| 14629 | { "CD", 0x4 }, |
| 14630 | }, |
| 14631 | }; |
| 14632 | |
| 14633 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 14634 | .num_items = 2, |
| 14635 | .items = { |
| 14636 | { "Mic", 0x1 }, |
| 14637 | { "Line", 0x2 }, |
| 14638 | }, |
| 14639 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14640 | |
| 14641 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 14642 | .num_items = 2, |
| 14643 | .items = { |
| 14644 | { "i-Mic", 0x1 }, |
| 14645 | { "e-Mic", 0x0 }, |
| 14646 | }, |
| 14647 | }; |
| 14648 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14649 | static struct hda_input_mux alc663_capture_source = { |
| 14650 | .num_items = 3, |
| 14651 | .items = { |
| 14652 | { "Mic", 0x0 }, |
| 14653 | { "Front Mic", 0x1 }, |
| 14654 | { "Line", 0x2 }, |
| 14655 | }, |
| 14656 | }; |
| 14657 | |
| 14658 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 14659 | .num_items = 2, |
| 14660 | .items = { |
| 14661 | { "Ext-Mic", 0x0 }, |
| 14662 | { "D-Mic", 0x9 }, |
| 14663 | }, |
| 14664 | }; |
| 14665 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14666 | #define alc662_mux_enum_info alc_mux_enum_info |
| 14667 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14668 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14669 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14670 | /* |
| 14671 | * 2ch mode |
| 14672 | */ |
| 14673 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 14674 | { 2, NULL } |
| 14675 | }; |
| 14676 | |
| 14677 | /* |
| 14678 | * 2ch mode |
| 14679 | */ |
| 14680 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 14681 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 14682 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14683 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 14684 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14685 | { } /* end */ |
| 14686 | }; |
| 14687 | |
| 14688 | /* |
| 14689 | * 6ch mode |
| 14690 | */ |
| 14691 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 14692 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14693 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14694 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 14695 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14696 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14697 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14698 | { } /* end */ |
| 14699 | }; |
| 14700 | |
| 14701 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 14702 | { 2, alc662_3ST_ch2_init }, |
| 14703 | { 6, alc662_3ST_ch6_init }, |
| 14704 | }; |
| 14705 | |
| 14706 | /* |
| 14707 | * 2ch mode |
| 14708 | */ |
| 14709 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 14710 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14711 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14712 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14713 | { } /* end */ |
| 14714 | }; |
| 14715 | |
| 14716 | /* |
| 14717 | * 6ch mode |
| 14718 | */ |
| 14719 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 14720 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14721 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14722 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14723 | { } /* end */ |
| 14724 | }; |
| 14725 | |
| 14726 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 14727 | { 2, alc662_sixstack_ch6_init }, |
| 14728 | { 6, alc662_sixstack_ch8_init }, |
| 14729 | }; |
| 14730 | |
| 14731 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14732 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14733 | */ |
| 14734 | |
| 14735 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 14736 | /* output mixer control */ |
| 14737 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14738 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14739 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14740 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14741 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14742 | 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] | 14743 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14744 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14745 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14746 | |
| 14747 | /*Input mixer control */ |
| 14748 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 14749 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 14750 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 14751 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 14752 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 14753 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 14754 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 14755 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14756 | { } /* end */ |
| 14757 | }; |
| 14758 | |
| 14759 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 14760 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14761 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14762 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14763 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14764 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14765 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14766 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14767 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14768 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14769 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14770 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14771 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14772 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14773 | { } /* end */ |
| 14774 | }; |
| 14775 | |
| 14776 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 14777 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14778 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14779 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14780 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14781 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14782 | 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] | 14783 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14784 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14785 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14786 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14787 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14788 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14789 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 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("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14793 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14794 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14795 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14796 | { } /* end */ |
| 14797 | }; |
| 14798 | |
| 14799 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 14800 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14801 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14802 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14803 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14804 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14805 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14806 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14807 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14808 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14809 | { } /* end */ |
| 14810 | }; |
| 14811 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14812 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14813 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14814 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 14815 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14816 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14817 | |
| 14818 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 14819 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14820 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14821 | |
| 14822 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 14823 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14824 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14825 | { } /* end */ |
| 14826 | }; |
| 14827 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14828 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 14829 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14830 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14831 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14832 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 14833 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14834 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 14835 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 14836 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14837 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14838 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14839 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14840 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14841 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14843 | { } /* end */ |
| 14844 | }; |
| 14845 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14846 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 14847 | .ops = &snd_hda_bind_vol, |
| 14848 | .values = { |
| 14849 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 14850 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 14851 | 0 |
| 14852 | }, |
| 14853 | }; |
| 14854 | |
| 14855 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 14856 | .ops = &snd_hda_bind_sw, |
| 14857 | .values = { |
| 14858 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14859 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 14860 | 0 |
| 14861 | }, |
| 14862 | }; |
| 14863 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14864 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14865 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14866 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 14867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14869 | { } /* end */ |
| 14870 | }; |
| 14871 | |
| 14872 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 14873 | .ops = &snd_hda_bind_sw, |
| 14874 | .values = { |
| 14875 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14876 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 14877 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 14878 | 0 |
| 14879 | }, |
| 14880 | }; |
| 14881 | |
| 14882 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 14883 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14884 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 14885 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14886 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14887 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14888 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14889 | |
| 14890 | { } /* end */ |
| 14891 | }; |
| 14892 | |
| 14893 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 14894 | .ops = &snd_hda_bind_sw, |
| 14895 | .values = { |
| 14896 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14897 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 14898 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 14899 | 0 |
| 14900 | }, |
| 14901 | }; |
| 14902 | |
| 14903 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 14904 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14905 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 14906 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14907 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14908 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14909 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14910 | { } /* end */ |
| 14911 | }; |
| 14912 | |
| 14913 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14914 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14915 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14916 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14917 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14918 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14919 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14920 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14921 | { } /* end */ |
| 14922 | }; |
| 14923 | |
| 14924 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 14925 | .ops = &snd_hda_bind_vol, |
| 14926 | .values = { |
| 14927 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 14928 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 14929 | 0 |
| 14930 | }, |
| 14931 | }; |
| 14932 | |
| 14933 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 14934 | .ops = &snd_hda_bind_sw, |
| 14935 | .values = { |
| 14936 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14937 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 14938 | 0 |
| 14939 | }, |
| 14940 | }; |
| 14941 | |
| 14942 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 14943 | HDA_BIND_VOL("Master Playback Volume", |
| 14944 | &alc663_asus_two_bind_master_vol), |
| 14945 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 14946 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14947 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14948 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14949 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14950 | { } /* end */ |
| 14951 | }; |
| 14952 | |
| 14953 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 14954 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14955 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 14956 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14957 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14958 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14959 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14960 | { } /* end */ |
| 14961 | }; |
| 14962 | |
| 14963 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 14964 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14965 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14966 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14967 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14968 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14969 | |
| 14970 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14971 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14972 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14973 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14974 | { } /* end */ |
| 14975 | }; |
| 14976 | |
| 14977 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 14978 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14979 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14980 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14981 | |
| 14982 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14983 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14984 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14985 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14986 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14987 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14988 | { } /* end */ |
| 14989 | }; |
| 14990 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14991 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 14992 | { |
| 14993 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14994 | .name = "Channel Mode", |
| 14995 | .info = alc_ch_mode_info, |
| 14996 | .get = alc_ch_mode_get, |
| 14997 | .put = alc_ch_mode_put, |
| 14998 | }, |
| 14999 | { } /* end */ |
| 15000 | }; |
| 15001 | |
| 15002 | static struct hda_verb alc662_init_verbs[] = { |
| 15003 | /* ADC: mute amp left and right */ |
| 15004 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15005 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15006 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15007 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15008 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15009 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15010 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15011 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15012 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15013 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15014 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15015 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15016 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15017 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15018 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15019 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15020 | |
| 15021 | /* Front Pin: output 0 (0x0c) */ |
| 15022 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15023 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15024 | |
| 15025 | /* Rear Pin: output 1 (0x0d) */ |
| 15026 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15028 | |
| 15029 | /* CLFE Pin: output 2 (0x0e) */ |
| 15030 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15031 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15032 | |
| 15033 | /* Mic (rear) pin: input vref at 80% */ |
| 15034 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15035 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15036 | /* Front Mic pin: input vref at 80% */ |
| 15037 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15038 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15039 | /* Line In pin: input */ |
| 15040 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15041 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15042 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15043 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15044 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15045 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15046 | /* CD pin widget for input */ |
| 15047 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15048 | |
| 15049 | /* FIXME: use matrix-type input source selection */ |
| 15050 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15051 | /* Input mixer */ |
| 15052 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15053 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15054 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15055 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15056 | |
| 15057 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15058 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15059 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15060 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15061 | |
| 15062 | /* always trun on EAPD */ |
| 15063 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15064 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15065 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15066 | { } |
| 15067 | }; |
| 15068 | |
| 15069 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15070 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15071 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15072 | {} |
| 15073 | }; |
| 15074 | |
| 15075 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15076 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15077 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15078 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15079 | }; |
| 15080 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15081 | /* Set Unsolicited Event*/ |
| 15082 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15083 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15084 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15085 | {} |
| 15086 | }; |
| 15087 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15088 | /* |
| 15089 | * generic initialization of ADC, input mixers and output mixers |
| 15090 | */ |
| 15091 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15092 | /* |
| 15093 | * Unmute ADC and set the default input to mic-in |
| 15094 | */ |
| 15095 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15096 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15097 | |
| 15098 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15099 | * mixer widget |
| 15100 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15101 | * panel mic (mic 2) |
| 15102 | */ |
| 15103 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15104 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15105 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15106 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15107 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15108 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15109 | |
| 15110 | /* |
| 15111 | * Set up output mixers (0x0c - 0x0f) |
| 15112 | */ |
| 15113 | /* set vol=0 to output mixers */ |
| 15114 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15115 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15116 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15117 | |
| 15118 | /* set up input amps for analog loopback */ |
| 15119 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15120 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15121 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15122 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15123 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15124 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15125 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15126 | |
| 15127 | |
| 15128 | /* FIXME: use matrix-type input source selection */ |
| 15129 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15130 | /* Input mixer */ |
| 15131 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15132 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15133 | { } |
| 15134 | }; |
| 15135 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15136 | /* additional verbs for ALC663 */ |
| 15137 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15138 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15139 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15140 | { } |
| 15141 | }; |
| 15142 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15143 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15144 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15145 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15146 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15147 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15148 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15149 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15150 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15151 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15152 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15153 | {} |
| 15154 | }; |
| 15155 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15156 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15157 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15158 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15159 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15160 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15161 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15162 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15163 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15164 | {} |
| 15165 | }; |
| 15166 | |
| 15167 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15168 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15169 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15170 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15171 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15172 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15173 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15174 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15175 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15176 | {} |
| 15177 | }; |
| 15178 | |
| 15179 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15180 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15181 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15182 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15183 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15185 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15186 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15187 | {} |
| 15188 | }; |
| 15189 | |
| 15190 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15191 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15192 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15193 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15194 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15195 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15196 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15197 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15198 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15199 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15200 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15201 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15202 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15203 | {} |
| 15204 | }; |
| 15205 | |
| 15206 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15207 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15208 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15209 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15210 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15212 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15213 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15214 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15215 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15216 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15217 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15218 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15219 | {} |
| 15220 | }; |
| 15221 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15222 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15223 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15224 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15225 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15226 | |
| 15227 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15228 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15229 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15230 | |
| 15231 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15232 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15233 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15234 | {} |
| 15235 | }; |
| 15236 | |
| 15237 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15238 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15239 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15240 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15241 | |
| 15242 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15243 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15244 | {} |
| 15245 | }; |
| 15246 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15247 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15248 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15249 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15250 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15251 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15252 | {} |
| 15253 | }; |
| 15254 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15255 | /* capture mixer elements */ |
| 15256 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 15257 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15258 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15259 | { |
| 15260 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15261 | /* The multiple "Capture Source" controls confuse alsamixer |
| 15262 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15263 | */ |
| 15264 | /* .name = "Capture Source", */ |
| 15265 | .name = "Input Source", |
| 15266 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 15267 | .info = alc662_mux_enum_info, |
| 15268 | .get = alc662_mux_enum_get, |
| 15269 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15270 | }, |
| 15271 | { } /* end */ |
| 15272 | }; |
| 15273 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15274 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15275 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15276 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15277 | { } /* end */ |
| 15278 | }; |
| 15279 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15280 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15281 | { |
| 15282 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15283 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15284 | |
| 15285 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15286 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15287 | bits = present ? HDA_AMP_MUTE : 0; |
| 15288 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15289 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15290 | } |
| 15291 | |
| 15292 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15293 | { |
| 15294 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15295 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15296 | |
| 15297 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15298 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15299 | bits = present ? HDA_AMP_MUTE : 0; |
| 15300 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15301 | HDA_AMP_MUTE, bits); |
| 15302 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15303 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15304 | } |
| 15305 | |
| 15306 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15307 | unsigned int res) |
| 15308 | { |
| 15309 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15310 | alc662_lenovo_101e_all_automute(codec); |
| 15311 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15312 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15313 | } |
| 15314 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15315 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15316 | { |
| 15317 | unsigned int present; |
| 15318 | |
| 15319 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15320 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15321 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15322 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15323 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15324 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15325 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15326 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15327 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15328 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15329 | } |
| 15330 | |
| 15331 | /* unsolicited event for HP jack sensing */ |
| 15332 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15333 | unsigned int res) |
| 15334 | { |
| 15335 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15336 | alc262_hippo1_automute( codec ); |
| 15337 | |
| 15338 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15339 | alc662_eeepc_mic_automute(codec); |
| 15340 | } |
| 15341 | |
| 15342 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15343 | { |
| 15344 | alc262_hippo1_automute( codec ); |
| 15345 | alc662_eeepc_mic_automute(codec); |
| 15346 | } |
| 15347 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15348 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 15349 | { |
| 15350 | unsigned int mute; |
| 15351 | unsigned int present; |
| 15352 | |
| 15353 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 15354 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15355 | AC_VERB_GET_PIN_SENSE, 0); |
| 15356 | present = (present & 0x80000000) != 0; |
| 15357 | if (present) { |
| 15358 | /* mute internal speaker */ |
| 15359 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15360 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15361 | } else { |
| 15362 | /* unmute internal speaker if necessary */ |
| 15363 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 15364 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15365 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15366 | } |
| 15367 | } |
| 15368 | |
| 15369 | /* unsolicited event for HP jack sensing */ |
| 15370 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 15371 | unsigned int res) |
| 15372 | { |
| 15373 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15374 | alc662_eeepc_ep20_automute(codec); |
| 15375 | } |
| 15376 | |
| 15377 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15378 | { |
| 15379 | alc662_eeepc_ep20_automute(codec); |
| 15380 | } |
| 15381 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15382 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15383 | { |
| 15384 | unsigned int present; |
| 15385 | unsigned char bits; |
| 15386 | |
| 15387 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15388 | AC_VERB_GET_PIN_SENSE, 0) |
| 15389 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15390 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15391 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15392 | AMP_IN_MUTE(0), bits); |
| 15393 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15394 | AMP_IN_MUTE(0), bits); |
| 15395 | } |
| 15396 | |
| 15397 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15398 | { |
| 15399 | unsigned int present; |
| 15400 | unsigned char bits; |
| 15401 | |
| 15402 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15403 | AC_VERB_GET_PIN_SENSE, 0) |
| 15404 | & AC_PINSENSE_PRESENCE; |
| 15405 | bits = present ? HDA_AMP_MUTE : 0; |
| 15406 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15407 | AMP_IN_MUTE(0), bits); |
| 15408 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15409 | AMP_IN_MUTE(0), bits); |
| 15410 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15411 | AMP_IN_MUTE(0), bits); |
| 15412 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15413 | AMP_IN_MUTE(0), bits); |
| 15414 | } |
| 15415 | |
| 15416 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15417 | { |
| 15418 | unsigned int present; |
| 15419 | unsigned char bits; |
| 15420 | |
| 15421 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15422 | AC_VERB_GET_PIN_SENSE, 0) |
| 15423 | & AC_PINSENSE_PRESENCE; |
| 15424 | bits = present ? HDA_AMP_MUTE : 0; |
| 15425 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15426 | AMP_IN_MUTE(0), bits); |
| 15427 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15428 | AMP_IN_MUTE(0), bits); |
| 15429 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15430 | AMP_IN_MUTE(0), bits); |
| 15431 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15432 | AMP_IN_MUTE(0), bits); |
| 15433 | } |
| 15434 | |
| 15435 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15436 | { |
| 15437 | unsigned int present; |
| 15438 | unsigned char bits; |
| 15439 | |
| 15440 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15441 | AC_VERB_GET_PIN_SENSE, 0) |
| 15442 | & AC_PINSENSE_PRESENCE; |
| 15443 | bits = present ? 0 : PIN_OUT; |
| 15444 | snd_hda_codec_write(codec, 0x14, 0, |
| 15445 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15446 | } |
| 15447 | |
| 15448 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15449 | { |
| 15450 | unsigned int present1, present2; |
| 15451 | |
| 15452 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15453 | AC_VERB_GET_PIN_SENSE, 0) |
| 15454 | & AC_PINSENSE_PRESENCE; |
| 15455 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15456 | AC_VERB_GET_PIN_SENSE, 0) |
| 15457 | & AC_PINSENSE_PRESENCE; |
| 15458 | |
| 15459 | if (present1 || present2) { |
| 15460 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15461 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 15462 | } else { |
| 15463 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15464 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 15465 | } |
| 15466 | } |
| 15467 | |
| 15468 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 15469 | { |
| 15470 | unsigned int present1, present2; |
| 15471 | |
| 15472 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 15473 | AC_VERB_GET_PIN_SENSE, 0) |
| 15474 | & AC_PINSENSE_PRESENCE; |
| 15475 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15476 | AC_VERB_GET_PIN_SENSE, 0) |
| 15477 | & AC_PINSENSE_PRESENCE; |
| 15478 | |
| 15479 | if (present1 || present2) { |
| 15480 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15481 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15482 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15483 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15484 | } else { |
| 15485 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15486 | AMP_IN_MUTE(0), 0); |
| 15487 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15488 | AMP_IN_MUTE(0), 0); |
| 15489 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15490 | } |
| 15491 | |
| 15492 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 15493 | { |
| 15494 | unsigned int present; |
| 15495 | |
| 15496 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15497 | AC_VERB_GET_PIN_SENSE, 0) |
| 15498 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15499 | 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] | 15500 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15501 | 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] | 15502 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15503 | 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] | 15504 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15505 | 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] | 15506 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15507 | } |
| 15508 | |
| 15509 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 15510 | unsigned int res) |
| 15511 | { |
| 15512 | switch (res >> 26) { |
| 15513 | case ALC880_HP_EVENT: |
| 15514 | alc663_m51va_speaker_automute(codec); |
| 15515 | break; |
| 15516 | case ALC880_MIC_EVENT: |
| 15517 | alc663_m51va_mic_automute(codec); |
| 15518 | break; |
| 15519 | } |
| 15520 | } |
| 15521 | |
| 15522 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 15523 | { |
| 15524 | alc663_m51va_speaker_automute(codec); |
| 15525 | alc663_m51va_mic_automute(codec); |
| 15526 | } |
| 15527 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15528 | /* ***************** Mode1 ******************************/ |
| 15529 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 15530 | unsigned int res) |
| 15531 | { |
| 15532 | switch (res >> 26) { |
| 15533 | case ALC880_HP_EVENT: |
| 15534 | alc663_m51va_speaker_automute(codec); |
| 15535 | break; |
| 15536 | case ALC880_MIC_EVENT: |
| 15537 | alc662_eeepc_mic_automute(codec); |
| 15538 | break; |
| 15539 | } |
| 15540 | } |
| 15541 | |
| 15542 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 15543 | { |
| 15544 | alc663_m51va_speaker_automute(codec); |
| 15545 | alc662_eeepc_mic_automute(codec); |
| 15546 | } |
| 15547 | /* ***************** Mode2 ******************************/ |
| 15548 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 15549 | unsigned int res) |
| 15550 | { |
| 15551 | switch (res >> 26) { |
| 15552 | case ALC880_HP_EVENT: |
| 15553 | alc662_f5z_speaker_automute(codec); |
| 15554 | break; |
| 15555 | case ALC880_MIC_EVENT: |
| 15556 | alc662_eeepc_mic_automute(codec); |
| 15557 | break; |
| 15558 | } |
| 15559 | } |
| 15560 | |
| 15561 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 15562 | { |
| 15563 | alc662_f5z_speaker_automute(codec); |
| 15564 | alc662_eeepc_mic_automute(codec); |
| 15565 | } |
| 15566 | /* ***************** Mode3 ******************************/ |
| 15567 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 15568 | unsigned int res) |
| 15569 | { |
| 15570 | switch (res >> 26) { |
| 15571 | case ALC880_HP_EVENT: |
| 15572 | alc663_two_hp_m1_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_mode3_inithook(struct hda_codec *codec) |
| 15581 | { |
| 15582 | alc663_two_hp_m1_speaker_automute(codec); |
| 15583 | alc662_eeepc_mic_automute(codec); |
| 15584 | } |
| 15585 | /* ***************** Mode4 ******************************/ |
| 15586 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 15587 | unsigned int res) |
| 15588 | { |
| 15589 | switch (res >> 26) { |
| 15590 | case ALC880_HP_EVENT: |
| 15591 | alc663_21jd_two_speaker_automute(codec); |
| 15592 | break; |
| 15593 | case ALC880_MIC_EVENT: |
| 15594 | alc662_eeepc_mic_automute(codec); |
| 15595 | break; |
| 15596 | } |
| 15597 | } |
| 15598 | |
| 15599 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 15600 | { |
| 15601 | alc663_21jd_two_speaker_automute(codec); |
| 15602 | alc662_eeepc_mic_automute(codec); |
| 15603 | } |
| 15604 | /* ***************** Mode5 ******************************/ |
| 15605 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 15606 | unsigned int res) |
| 15607 | { |
| 15608 | switch (res >> 26) { |
| 15609 | case ALC880_HP_EVENT: |
| 15610 | alc663_15jd_two_speaker_automute(codec); |
| 15611 | break; |
| 15612 | case ALC880_MIC_EVENT: |
| 15613 | alc662_eeepc_mic_automute(codec); |
| 15614 | break; |
| 15615 | } |
| 15616 | } |
| 15617 | |
| 15618 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 15619 | { |
| 15620 | alc663_15jd_two_speaker_automute(codec); |
| 15621 | alc662_eeepc_mic_automute(codec); |
| 15622 | } |
| 15623 | /* ***************** Mode6 ******************************/ |
| 15624 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 15625 | unsigned int res) |
| 15626 | { |
| 15627 | switch (res >> 26) { |
| 15628 | case ALC880_HP_EVENT: |
| 15629 | alc663_two_hp_m2_speaker_automute(codec); |
| 15630 | break; |
| 15631 | case ALC880_MIC_EVENT: |
| 15632 | alc662_eeepc_mic_automute(codec); |
| 15633 | break; |
| 15634 | } |
| 15635 | } |
| 15636 | |
| 15637 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 15638 | { |
| 15639 | alc663_two_hp_m2_speaker_automute(codec); |
| 15640 | alc662_eeepc_mic_automute(codec); |
| 15641 | } |
| 15642 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15643 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 15644 | { |
| 15645 | unsigned int present; |
| 15646 | unsigned char bits; |
| 15647 | |
| 15648 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15649 | AC_VERB_GET_PIN_SENSE, 0) |
| 15650 | & AC_PINSENSE_PRESENCE; |
| 15651 | bits = present ? HDA_AMP_MUTE : 0; |
| 15652 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15653 | HDA_AMP_MUTE, bits); |
| 15654 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15655 | HDA_AMP_MUTE, bits); |
| 15656 | } |
| 15657 | |
| 15658 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 15659 | { |
| 15660 | unsigned int present; |
| 15661 | unsigned char bits; |
| 15662 | |
| 15663 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15664 | AC_VERB_GET_PIN_SENSE, 0) |
| 15665 | & AC_PINSENSE_PRESENCE; |
| 15666 | bits = present ? HDA_AMP_MUTE : 0; |
| 15667 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15668 | HDA_AMP_MUTE, bits); |
| 15669 | } |
| 15670 | |
| 15671 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 15672 | unsigned int res) |
| 15673 | { |
| 15674 | switch (res >> 26) { |
| 15675 | case ALC880_HP_EVENT: |
| 15676 | alc663_g71v_hp_automute(codec); |
| 15677 | break; |
| 15678 | case ALC880_FRONT_EVENT: |
| 15679 | alc663_g71v_front_automute(codec); |
| 15680 | break; |
| 15681 | case ALC880_MIC_EVENT: |
| 15682 | alc662_eeepc_mic_automute(codec); |
| 15683 | break; |
| 15684 | } |
| 15685 | } |
| 15686 | |
| 15687 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 15688 | { |
| 15689 | alc663_g71v_front_automute(codec); |
| 15690 | alc663_g71v_hp_automute(codec); |
| 15691 | alc662_eeepc_mic_automute(codec); |
| 15692 | } |
| 15693 | |
| 15694 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 15695 | unsigned int res) |
| 15696 | { |
| 15697 | switch (res >> 26) { |
| 15698 | case ALC880_HP_EVENT: |
| 15699 | alc663_m51va_speaker_automute(codec); |
| 15700 | break; |
| 15701 | case ALC880_MIC_EVENT: |
| 15702 | alc662_eeepc_mic_automute(codec); |
| 15703 | break; |
| 15704 | } |
| 15705 | } |
| 15706 | |
| 15707 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 15708 | { |
| 15709 | alc663_m51va_speaker_automute(codec); |
| 15710 | alc662_eeepc_mic_automute(codec); |
| 15711 | } |
| 15712 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15713 | /* bind hp and internal speaker mute (with plug check) */ |
| 15714 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 15715 | struct snd_ctl_elem_value *ucontrol) |
| 15716 | { |
| 15717 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 15718 | long *valp = ucontrol->value.integer.value; |
| 15719 | int change; |
| 15720 | |
| 15721 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 15722 | HDA_AMP_MUTE, |
| 15723 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 15724 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 15725 | HDA_AMP_MUTE, |
| 15726 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 15727 | if (change) |
| 15728 | alc262_hippo1_automute(codec); |
| 15729 | return change; |
| 15730 | } |
| 15731 | |
| 15732 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 15733 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15734 | { |
| 15735 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15736 | .name = "Master Playback Switch", |
| 15737 | .info = snd_hda_mixer_amp_switch_info, |
| 15738 | .get = snd_hda_mixer_amp_switch_get, |
| 15739 | .put = alc662_ecs_master_sw_put, |
| 15740 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15741 | }, |
| 15742 | |
| 15743 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 15744 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15745 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15746 | |
| 15747 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15748 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15749 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15750 | { } /* end */ |
| 15751 | }; |
| 15752 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15753 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15754 | #define alc662_loopbacks alc880_loopbacks |
| 15755 | #endif |
| 15756 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15757 | |
| 15758 | /* pcm configuration: identiacal with ALC880 */ |
| 15759 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 15760 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 15761 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 15762 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 15763 | |
| 15764 | /* |
| 15765 | * configuration and preset |
| 15766 | */ |
| 15767 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 15768 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 15769 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 15770 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 15771 | [ALC662_5ST_DIG] = "6stack-dig", |
| 15772 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 15773 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15774 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15775 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15776 | [ALC663_ASUS_M51VA] = "m51va", |
| 15777 | [ALC663_ASUS_G71V] = "g71v", |
| 15778 | [ALC663_ASUS_H13] = "h13", |
| 15779 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15780 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 15781 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 15782 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 15783 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 15784 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 15785 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15786 | [ALC662_AUTO] = "auto", |
| 15787 | }; |
| 15788 | |
| 15789 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15790 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 15791 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 15792 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15793 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15794 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15795 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 15796 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), |
| 15797 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 15798 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 15799 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 15800 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15801 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15802 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 15803 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 15804 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15805 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
| 15806 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 15807 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 15808 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
| 15809 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 15810 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 15811 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
| 15812 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 15813 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
| 15814 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 15815 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 15816 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
| 15817 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 15818 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 15819 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
| 15820 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
| 15821 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 15822 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
| 15823 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 15824 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 15825 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 15826 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 15827 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 15828 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15829 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15830 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
| 15831 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 15832 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 15833 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 15834 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 15835 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 15836 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15837 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
| 15838 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
| 15839 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15840 | {} |
| 15841 | }; |
| 15842 | |
| 15843 | static struct alc_config_preset alc662_presets[] = { |
| 15844 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15845 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15846 | .init_verbs = { alc662_init_verbs }, |
| 15847 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15848 | .dac_nids = alc662_dac_nids, |
| 15849 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15850 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15851 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15852 | .channel_mode = alc662_3ST_2ch_modes, |
| 15853 | .input_mux = &alc662_capture_source, |
| 15854 | }, |
| 15855 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15856 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 15857 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15858 | .init_verbs = { alc662_init_verbs }, |
| 15859 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15860 | .dac_nids = alc662_dac_nids, |
| 15861 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15862 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15863 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15864 | .channel_mode = alc662_3ST_6ch_modes, |
| 15865 | .need_dac_fix = 1, |
| 15866 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15867 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15868 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15869 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 15870 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15871 | .init_verbs = { alc662_init_verbs }, |
| 15872 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15873 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15874 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15875 | .channel_mode = alc662_3ST_6ch_modes, |
| 15876 | .need_dac_fix = 1, |
| 15877 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15878 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15879 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15880 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 15881 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15882 | .init_verbs = { alc662_init_verbs }, |
| 15883 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15884 | .dac_nids = alc662_dac_nids, |
| 15885 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15886 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15887 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 15888 | .channel_mode = alc662_5stack_modes, |
| 15889 | .input_mux = &alc662_capture_source, |
| 15890 | }, |
| 15891 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15892 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15893 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 15894 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15895 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15896 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15897 | .channel_mode = alc662_3ST_2ch_modes, |
| 15898 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 15899 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 15900 | .init_hook = alc662_lenovo_101e_all_automute, |
| 15901 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15902 | [ALC662_ASUS_EEEPC_P701] = { |
| 15903 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 15904 | .init_verbs = { alc662_init_verbs, |
| 15905 | alc662_eeepc_sue_init_verbs }, |
| 15906 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15907 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 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 = alc662_eeepc_unsol_event, |
| 15912 | .init_hook = alc662_eeepc_inithook, |
| 15913 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15914 | [ALC662_ASUS_EEEPC_EP20] = { |
| 15915 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 15916 | alc662_chmode_mixer }, |
| 15917 | .init_verbs = { alc662_init_verbs, |
| 15918 | alc662_eeepc_ep20_sue_init_verbs }, |
| 15919 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15920 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15921 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15922 | .channel_mode = alc662_3ST_6ch_modes, |
| 15923 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 15924 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 15925 | .init_hook = alc662_eeepc_ep20_inithook, |
| 15926 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15927 | [ALC662_ECS] = { |
| 15928 | .mixers = { alc662_ecs_mixer, alc662_capture_mixer }, |
| 15929 | .init_verbs = { alc662_init_verbs, |
| 15930 | alc662_ecs_init_verbs }, |
| 15931 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15932 | .dac_nids = alc662_dac_nids, |
| 15933 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15934 | .channel_mode = alc662_3ST_2ch_modes, |
| 15935 | .input_mux = &alc662_eeepc_capture_source, |
| 15936 | .unsol_event = alc662_eeepc_unsol_event, |
| 15937 | .init_hook = alc662_eeepc_inithook, |
| 15938 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15939 | [ALC663_ASUS_M51VA] = { |
| 15940 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 15941 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 15942 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15943 | .dac_nids = alc662_dac_nids, |
| 15944 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15945 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15946 | .channel_mode = alc662_3ST_2ch_modes, |
| 15947 | .input_mux = &alc663_m51va_capture_source, |
| 15948 | .unsol_event = alc663_m51va_unsol_event, |
| 15949 | .init_hook = alc663_m51va_inithook, |
| 15950 | }, |
| 15951 | [ALC663_ASUS_G71V] = { |
| 15952 | .mixers = { alc663_g71v_mixer, alc662_capture_mixer}, |
| 15953 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 15954 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15955 | .dac_nids = alc662_dac_nids, |
| 15956 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15957 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15958 | .channel_mode = alc662_3ST_2ch_modes, |
| 15959 | .input_mux = &alc662_eeepc_capture_source, |
| 15960 | .unsol_event = alc663_g71v_unsol_event, |
| 15961 | .init_hook = alc663_g71v_inithook, |
| 15962 | }, |
| 15963 | [ALC663_ASUS_H13] = { |
| 15964 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 15965 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 15966 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15967 | .dac_nids = alc662_dac_nids, |
| 15968 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15969 | .channel_mode = alc662_3ST_2ch_modes, |
| 15970 | .input_mux = &alc663_m51va_capture_source, |
| 15971 | .unsol_event = alc663_m51va_unsol_event, |
| 15972 | .init_hook = alc663_m51va_inithook, |
| 15973 | }, |
| 15974 | [ALC663_ASUS_G50V] = { |
| 15975 | .mixers = { alc663_g50v_mixer, alc662_capture_mixer}, |
| 15976 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 15977 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15978 | .dac_nids = alc662_dac_nids, |
| 15979 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15980 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15981 | .channel_mode = alc662_3ST_6ch_modes, |
| 15982 | .input_mux = &alc663_capture_source, |
| 15983 | .unsol_event = alc663_g50v_unsol_event, |
| 15984 | .init_hook = alc663_g50v_inithook, |
| 15985 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15986 | [ALC663_ASUS_MODE1] = { |
| 15987 | .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer }, |
| 15988 | .init_verbs = { alc662_init_verbs, |
| 15989 | alc663_21jd_amic_init_verbs }, |
| 15990 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15991 | .hp_nid = 0x03, |
| 15992 | .dac_nids = alc662_dac_nids, |
| 15993 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15994 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15995 | .channel_mode = alc662_3ST_2ch_modes, |
| 15996 | .input_mux = &alc662_eeepc_capture_source, |
| 15997 | .unsol_event = alc663_mode1_unsol_event, |
| 15998 | .init_hook = alc663_mode1_inithook, |
| 15999 | }, |
| 16000 | [ALC662_ASUS_MODE2] = { |
| 16001 | .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer }, |
| 16002 | .init_verbs = { alc662_init_verbs, |
| 16003 | alc662_1bjd_amic_init_verbs }, |
| 16004 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16005 | .dac_nids = alc662_dac_nids, |
| 16006 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16007 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16008 | .channel_mode = alc662_3ST_2ch_modes, |
| 16009 | .input_mux = &alc662_eeepc_capture_source, |
| 16010 | .unsol_event = alc662_mode2_unsol_event, |
| 16011 | .init_hook = alc662_mode2_inithook, |
| 16012 | }, |
| 16013 | [ALC663_ASUS_MODE3] = { |
| 16014 | .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer }, |
| 16015 | .init_verbs = { alc662_init_verbs, |
| 16016 | alc663_two_hp_amic_m1_init_verbs }, |
| 16017 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16018 | .hp_nid = 0x03, |
| 16019 | .dac_nids = alc662_dac_nids, |
| 16020 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16021 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16022 | .channel_mode = alc662_3ST_2ch_modes, |
| 16023 | .input_mux = &alc662_eeepc_capture_source, |
| 16024 | .unsol_event = alc663_mode3_unsol_event, |
| 16025 | .init_hook = alc663_mode3_inithook, |
| 16026 | }, |
| 16027 | [ALC663_ASUS_MODE4] = { |
| 16028 | .mixers = { alc663_asus_21jd_clfe_mixer, |
| 16029 | alc662_auto_capture_mixer}, |
| 16030 | .init_verbs = { alc662_init_verbs, |
| 16031 | alc663_21jd_amic_init_verbs}, |
| 16032 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16033 | .hp_nid = 0x03, |
| 16034 | .dac_nids = alc662_dac_nids, |
| 16035 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16036 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16037 | .channel_mode = alc662_3ST_2ch_modes, |
| 16038 | .input_mux = &alc662_eeepc_capture_source, |
| 16039 | .unsol_event = alc663_mode4_unsol_event, |
| 16040 | .init_hook = alc663_mode4_inithook, |
| 16041 | }, |
| 16042 | [ALC663_ASUS_MODE5] = { |
| 16043 | .mixers = { alc663_asus_15jd_clfe_mixer, |
| 16044 | alc662_auto_capture_mixer }, |
| 16045 | .init_verbs = { alc662_init_verbs, |
| 16046 | alc663_15jd_amic_init_verbs }, |
| 16047 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16048 | .hp_nid = 0x03, |
| 16049 | .dac_nids = alc662_dac_nids, |
| 16050 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16051 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16052 | .channel_mode = alc662_3ST_2ch_modes, |
| 16053 | .input_mux = &alc662_eeepc_capture_source, |
| 16054 | .unsol_event = alc663_mode5_unsol_event, |
| 16055 | .init_hook = alc663_mode5_inithook, |
| 16056 | }, |
| 16057 | [ALC663_ASUS_MODE6] = { |
| 16058 | .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer }, |
| 16059 | .init_verbs = { alc662_init_verbs, |
| 16060 | alc663_two_hp_amic_m2_init_verbs }, |
| 16061 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16062 | .hp_nid = 0x03, |
| 16063 | .dac_nids = alc662_dac_nids, |
| 16064 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16065 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16066 | .channel_mode = alc662_3ST_2ch_modes, |
| 16067 | .input_mux = &alc662_eeepc_capture_source, |
| 16068 | .unsol_event = alc663_mode6_unsol_event, |
| 16069 | .init_hook = alc663_mode6_inithook, |
| 16070 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16071 | }; |
| 16072 | |
| 16073 | |
| 16074 | /* |
| 16075 | * BIOS auto configuration |
| 16076 | */ |
| 16077 | |
| 16078 | /* add playback controls from the parsed DAC table */ |
| 16079 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16080 | const struct auto_pin_cfg *cfg) |
| 16081 | { |
| 16082 | char name[32]; |
| 16083 | static const char *chname[4] = { |
| 16084 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16085 | }; |
| 16086 | hda_nid_t nid; |
| 16087 | int i, err; |
| 16088 | |
| 16089 | for (i = 0; i < cfg->line_outs; i++) { |
| 16090 | if (!spec->multiout.dac_nids[i]) |
| 16091 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16092 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16093 | if (i == 2) { |
| 16094 | /* Center/LFE */ |
| 16095 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16096 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16097 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16098 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16099 | if (err < 0) |
| 16100 | return err; |
| 16101 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16102 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16103 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16104 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16105 | if (err < 0) |
| 16106 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16107 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16108 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16109 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16110 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16111 | if (err < 0) |
| 16112 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16113 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16114 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16115 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16116 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16117 | if (err < 0) |
| 16118 | return err; |
| 16119 | } else { |
| 16120 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16121 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16122 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16123 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16124 | if (err < 0) |
| 16125 | return err; |
| 16126 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16127 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16128 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16129 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16130 | if (err < 0) |
| 16131 | return err; |
| 16132 | } |
| 16133 | } |
| 16134 | return 0; |
| 16135 | } |
| 16136 | |
| 16137 | /* add playback controls for speaker and HP outputs */ |
| 16138 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16139 | const char *pfx) |
| 16140 | { |
| 16141 | hda_nid_t nid; |
| 16142 | int err; |
| 16143 | char name[32]; |
| 16144 | |
| 16145 | if (!pin) |
| 16146 | return 0; |
| 16147 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16148 | if (pin == 0x17) { |
| 16149 | /* ALC663 has a mono output pin on 0x17 */ |
| 16150 | sprintf(name, "%s Playback Switch", pfx); |
| 16151 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16152 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16153 | return err; |
| 16154 | } |
| 16155 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16156 | if (alc880_is_fixed_pin(pin)) { |
| 16157 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16158 | /* printk("DAC nid=%x\n",nid); */ |
| 16159 | /* specify the DAC as the extra output */ |
| 16160 | if (!spec->multiout.hp_nid) |
| 16161 | spec->multiout.hp_nid = nid; |
| 16162 | else |
| 16163 | spec->multiout.extra_out_nid[0] = nid; |
| 16164 | /* control HP volume/switch on the output mixer amp */ |
| 16165 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16166 | sprintf(name, "%s Playback Volume", pfx); |
| 16167 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16168 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16169 | if (err < 0) |
| 16170 | return err; |
| 16171 | sprintf(name, "%s Playback Switch", pfx); |
| 16172 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16173 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16174 | if (err < 0) |
| 16175 | return err; |
| 16176 | } else if (alc880_is_multi_pin(pin)) { |
| 16177 | /* set manual connection */ |
| 16178 | /* we have only a switch on HP-out PIN */ |
| 16179 | sprintf(name, "%s Playback Switch", pfx); |
| 16180 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16181 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16182 | if (err < 0) |
| 16183 | return err; |
| 16184 | } |
| 16185 | return 0; |
| 16186 | } |
| 16187 | |
| 16188 | /* create playback/capture controls for input pins */ |
| 16189 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 16190 | const struct auto_pin_cfg *cfg) |
| 16191 | { |
| 16192 | struct hda_input_mux *imux = &spec->private_imux; |
| 16193 | int i, err, idx; |
| 16194 | |
| 16195 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16196 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 16197 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 16198 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16199 | auto_pin_cfg_labels[i], |
| 16200 | idx, 0x0b); |
| 16201 | if (err < 0) |
| 16202 | return err; |
| 16203 | imux->items[imux->num_items].label = |
| 16204 | auto_pin_cfg_labels[i]; |
| 16205 | imux->items[imux->num_items].index = |
| 16206 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 16207 | imux->num_items++; |
| 16208 | } |
| 16209 | } |
| 16210 | return 0; |
| 16211 | } |
| 16212 | |
| 16213 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16214 | hda_nid_t nid, int pin_type, |
| 16215 | int dac_idx) |
| 16216 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16217 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16218 | /* need the manual connection? */ |
| 16219 | if (alc880_is_multi_pin(nid)) { |
| 16220 | struct alc_spec *spec = codec->spec; |
| 16221 | int idx = alc880_multi_pin_idx(nid); |
| 16222 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16223 | AC_VERB_SET_CONNECT_SEL, |
| 16224 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16225 | } |
| 16226 | } |
| 16227 | |
| 16228 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16229 | { |
| 16230 | struct alc_spec *spec = codec->spec; |
| 16231 | int i; |
| 16232 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16233 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16234 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16235 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16236 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16237 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16238 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16239 | i); |
| 16240 | } |
| 16241 | } |
| 16242 | |
| 16243 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16244 | { |
| 16245 | struct alc_spec *spec = codec->spec; |
| 16246 | hda_nid_t pin; |
| 16247 | |
| 16248 | pin = spec->autocfg.hp_pins[0]; |
| 16249 | if (pin) /* connect to front */ |
| 16250 | /* use dac 0 */ |
| 16251 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16252 | pin = spec->autocfg.speaker_pins[0]; |
| 16253 | if (pin) |
| 16254 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16255 | } |
| 16256 | |
| 16257 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 16258 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16259 | |
| 16260 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16261 | { |
| 16262 | struct alc_spec *spec = codec->spec; |
| 16263 | int i; |
| 16264 | |
| 16265 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16266 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 16267 | if (alc662_is_input_pin(nid)) { |
| 16268 | snd_hda_codec_write(codec, nid, 0, |
| 16269 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16270 | (i <= AUTO_PIN_FRONT_MIC ? |
| 16271 | PIN_VREF80 : PIN_IN)); |
| 16272 | if (nid != ALC662_PIN_CD_NID) |
| 16273 | snd_hda_codec_write(codec, nid, 0, |
| 16274 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16275 | AMP_OUT_MUTE); |
| 16276 | } |
| 16277 | } |
| 16278 | } |
| 16279 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16280 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16281 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16282 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16283 | { |
| 16284 | struct alc_spec *spec = codec->spec; |
| 16285 | int err; |
| 16286 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16287 | |
| 16288 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16289 | alc662_ignore); |
| 16290 | if (err < 0) |
| 16291 | return err; |
| 16292 | if (!spec->autocfg.line_outs) |
| 16293 | return 0; /* can't find valid BIOS pin config */ |
| 16294 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16295 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16296 | if (err < 0) |
| 16297 | return err; |
| 16298 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16299 | if (err < 0) |
| 16300 | return err; |
| 16301 | err = alc662_auto_create_extra_out(spec, |
| 16302 | spec->autocfg.speaker_pins[0], |
| 16303 | "Speaker"); |
| 16304 | if (err < 0) |
| 16305 | return err; |
| 16306 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16307 | "Headphone"); |
| 16308 | if (err < 0) |
| 16309 | return err; |
| 16310 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 16311 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16312 | return err; |
| 16313 | |
| 16314 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16315 | |
| 16316 | if (spec->autocfg.dig_out_pin) |
| 16317 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16318 | |
| 16319 | if (spec->kctl_alloc) |
| 16320 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 16321 | |
| 16322 | spec->num_mux_defs = 1; |
| 16323 | spec->input_mux = &spec->private_imux; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16324 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16325 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16326 | if (codec->vendor_id == 0x10ec0663) |
| 16327 | spec->init_verbs[spec->num_init_verbs++] = |
| 16328 | alc663_auto_init_verbs; |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16329 | |
| 16330 | err = alc_auto_add_mic_boost(codec); |
| 16331 | if (err < 0) |
| 16332 | return err; |
| 16333 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16334 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 16335 | spec->num_mixers++; |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame^] | 16336 | |
| 16337 | store_pin_configs(codec); |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16338 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16339 | } |
| 16340 | |
| 16341 | /* additional initialization for auto-configuration model */ |
| 16342 | static void alc662_auto_init(struct hda_codec *codec) |
| 16343 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16344 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16345 | alc662_auto_init_multi_out(codec); |
| 16346 | alc662_auto_init_hp_out(codec); |
| 16347 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16348 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16349 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16350 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16351 | } |
| 16352 | |
| 16353 | static int patch_alc662(struct hda_codec *codec) |
| 16354 | { |
| 16355 | struct alc_spec *spec; |
| 16356 | int err, board_config; |
| 16357 | |
| 16358 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16359 | if (!spec) |
| 16360 | return -ENOMEM; |
| 16361 | |
| 16362 | codec->spec = spec; |
| 16363 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16364 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16365 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16366 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16367 | alc662_models, |
| 16368 | alc662_cfg_tbl); |
| 16369 | if (board_config < 0) { |
| 16370 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16371 | "trying auto-probe from BIOS...\n"); |
| 16372 | board_config = ALC662_AUTO; |
| 16373 | } |
| 16374 | |
| 16375 | if (board_config == ALC662_AUTO) { |
| 16376 | /* automatic parse from the BIOS config */ |
| 16377 | err = alc662_parse_auto_config(codec); |
| 16378 | if (err < 0) { |
| 16379 | alc_free(codec); |
| 16380 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16381 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16382 | printk(KERN_INFO |
| 16383 | "hda_codec: Cannot set up configuration " |
| 16384 | "from BIOS. Using base mode...\n"); |
| 16385 | board_config = ALC662_3ST_2ch_DIG; |
| 16386 | } |
| 16387 | } |
| 16388 | |
| 16389 | if (board_config != ALC662_AUTO) |
| 16390 | setup_preset(spec, &alc662_presets[board_config]); |
| 16391 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16392 | if (codec->vendor_id == 0x10ec0663) { |
| 16393 | spec->stream_name_analog = "ALC663 Analog"; |
| 16394 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16395 | } else if (codec->vendor_id == 0x10ec0272) { |
| 16396 | spec->stream_name_analog = "ALC272 Analog"; |
| 16397 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16398 | } else { |
| 16399 | spec->stream_name_analog = "ALC662 Analog"; |
| 16400 | spec->stream_name_digital = "ALC662 Digital"; |
| 16401 | } |
| 16402 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16403 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16404 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16405 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16406 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16407 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16408 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16409 | spec->adc_nids = alc662_adc_nids; |
| 16410 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16411 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16412 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16413 | spec->vmaster_nid = 0x02; |
| 16414 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16415 | codec->patch_ops = alc_patch_ops; |
| 16416 | if (board_config == ALC662_AUTO) |
| 16417 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16418 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16419 | if (!spec->loopback.amplist) |
| 16420 | spec->loopback.amplist = alc662_loopbacks; |
| 16421 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16422 | |
| 16423 | return 0; |
| 16424 | } |
| 16425 | |
| 16426 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16427 | * patch entries |
| 16428 | */ |
| 16429 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 16430 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16431 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16432 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 16433 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16434 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16435 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16436 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16437 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16438 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 16439 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 16440 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16441 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 16442 | .patch = patch_alc883 }, |
| 16443 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 16444 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16445 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16446 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16447 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16448 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 16449 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 16450 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 16451 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 16452 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16453 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 16454 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16455 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 16456 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 16457 | .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16458 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16459 | {} /* terminator */ |
| 16460 | }; |